安裝fairseq: pip install --editable 始終卡進度條 installing build dependencies…|解決辦法
更新03.08
倘若git clone -release 分支而不是main 分支,pip install --editable大概也不會報錯了…
我遇到的問題,有可能是由于main分支尚存在bug,install時遇到bug不得不卡住。
(暴風哭泣 心疼我的時間)
在Linux上創(chuàng)建了個虛擬環(huán)境,F(xiàn)airseq安裝指導說,只需要簡單的 三步 即可完成…然后我用了三天。
Fairseq給出的安裝方法:
# To install fairseq and develop locally
git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable ./
問題
運行pip install --editable ./
時,卡在installing build dependencies…|,沒有報錯和提示。
首先排除了鏡像源(網(wǎng)絡問題連不上pypi服務器)的可能;然后試圖換conda install --use-local fairseq
也沒用。
我的安裝環(huán)境是:
- python 3.8
- torch 1.12
- cuda 11.3
解決
第一步,改用pip install --editable ./ --no-build-isolation
。方法參考自fairseq issue。
The idea is that a package can be built more consistently if it’s not affected by the packages in your working environment. h5py normally says it requires numpy & Cython, but setting H5PY_SETUP_REQUIRES=0 disables that, so pip tries to build it without them. The --no-build-isolation flag for pip install tells pip that you have already installed the build dependencies and want to build with whatever packages are in the environment where pip itself is installed.
所以查閱github issues真的很重要!(為什么我沒有早一點看到它…雖然并不懂這一步的作用。
第二步,創(chuàng)建虛擬環(huán)境 --> 安裝正確版本的torch --> 安裝fairseq。(順序很重要)
我安裝fairseq-main的時候(2023/02/12),只能用torch 1.13;我試了用1.12安裝fairseq,它會自動刪除1.12,然后更新下載1.13,而且安裝后會報錯:OSError: …/site-packages/nvidia/cublas/lib/libcublas.so.11: symbol cublasLtGetStatusString version libcublasLt.so.11 not defined in file libcublasLt.so.11 with link time reference。
上具體代碼:
# 創(chuàng)建虛擬環(huán)境
conda create -n pure38 python=3.8
# 安裝torch 1.13
# 可以在官網(wǎng)查詢:https://pytorch.org/get-started/locally/
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
# 下載fairseq-main
git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable ./ --no-build-isolation
安裝后,我還遇到了一個報錯:找不到sentencepiece包
于是,
pip install sentencepiece
然后成功了??!隱去了個人信息 ??
文章來源:http://www.zghlxwxcb.cn/news/detail-785144.html
祝大家好運?。?span toymoban-style="hidden">文章來源地址http://www.zghlxwxcb.cn/news/detail-785144.html
到了這里,關于安裝fairseq: pip install --editable 始終卡進度條 installing build dependencies...|解決辦法的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!