pip離線安裝Bottleneck報Error解決


1. 前言

操作系統:centos7.2

python版本:3.7

pip版本:20.2.4

公司一個AI項目需要部署,但是客戶的服務器環境是在內網,無法聯網更新,於是在公司開發服創建了一個同樣的環境,離線下載安裝包后再進行安裝,關於離線安裝可以參考:python使用pip離線安裝庫

因為使用了一個叫fastai的庫,需要依賴Bottleneck,然后這個包就真的成為我的bottleneck了。

因為懷疑是前面依賴問題,於是將numpy之類的依賴安裝后,再單獨安裝Bottleneck,安裝命令:

pip install Bottleneck-1.3.2.tar.gz

報錯:

Processing ./Bottleneck-1.3.2.tar.gz
   Installing build dependencies ... error
   ERROR: Command errored out with exit status 1:
    command: /usr/local/python3/bin/python3.7 /usr/local/python3/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-1g2lyacs/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'numpy==1.13.3; python_version=='"'"'2.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'2.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"''
        cwd: None
   Complete output (16 lines):
   Ignoring numpy: markers 'python_version == "2.7" and platform_system != "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version == "3.5" and platform_system != "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version >= "3.8" and platform_system != "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version == "2.7" and platform_system == "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version == "3.5" and platform_system == "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version == "3.7" and platform_system == "AIX"' don't match your environment
   Ignoring numpy: markers 'python_version >= "3.8" and platform_system == "AIX"' don't match your environment
   WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcfa878e3c8>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
   WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcfa6008e48>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
   WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcfa6008358>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
   WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcfa6008780>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
   WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcfa6008048>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
   ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none)
   ERROR: No matching distribution found for setuptools
   ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/python3/bin/python3.7 /usr/local/python3/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-1g2lyacs/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'numpy==1.13.3; python_version=='"'"'2.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'2.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' Check the logs for full command output.

將numpy降為里面要求的1.16.0版本,依舊無法通過。

按照官網的教程:https://pypi.org/project/Bottleneck/,解壓后在文件夾中進行安裝:

pip install .

依舊報一樣的問題。

 

2. 解決

用google上查到的大多說是項目本身的bug,pip無能為力之類的,所以只能從編譯項目的角度去解決。

通過閱讀解壓后的文件,我在一個叫versioneer.py的文件中找到了下面這段話:

Versioneer will look for `.git` in parent directories, and most operations

should get the right version string. However `pip` and `setuptools` have bugs

and implementation details which frequently cause `pip install .` from a

subproject directory to fail to find a correct version string (so it usually

defaults to `0+unknown`).

`pip install --editable .` should work correctly. `setup.py install` might

work too.

Pip-8.1.1 is known to have this problem, but hopefully it will get fixed in

some later version.

嘗試:

pip install --editable

依舊有錯。

繼續嘗試:

python setup.py install

 

沒想到就可以了,安裝完成后沒有報錯,使用

pip list | grep Bottle

顯示:

Bottleneck         1.3.2

安裝成功。

 

3. 參考

(完)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM