关于basicsr==1.4.2安装失败的终极解决方案

相信最近大家在做一些东西的时候,要用到basicsr插件(pip安装),在某些ubuntu机子上面

pip install basicsr==1.4.2是安装失败的。报错如下:

Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/ Collecting basicsr==1.4.2 Using cached http://mirrors.cloud.aliyuncs.com/pypi/packages/86/41/00a6b000f222f0fa4c6d9e1d6dcc9811a374cabb8abb9d408b77de39648c/basicsr-1.4.2.tar.gz (172 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [63 lines of output] /root/anaconda3/envs/sdweb/lib/python3.9/site-packages/setuptools/dist.py:745: SetuptoolsDeprecationWarning: Invalid dash-separated options !! ******************************************************************************** Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! opt = self.warn_dash_deprecation(opt, section)

关于这个错误。网上的答案有很多种,有人说是setuptools的问题,甚至有人说是numpy的问题,还有不少人说是pip源的问题。其实这个错误主要出现在ubuntu机子上面。WINDOWS系统一般是不会出这个错误的。

按照网上的这些做法,这个错误是不会消失的。basicsr你也永远装不起来。本人也一直在抓狂中,冷静下来好好分析错误。其实在下方的错误提示中我们能找到答案:

distutils.errors.DistutilsError: Command '['/root/anaconda3/envs/sdweb/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmptd7ltyx7', '--quiet', '--index-url', 'http://mirrors.cloud.aliyuncs.com/pypi/simple/', 'torch']' returned non-zero exit status 1.

看看这个pip,应该是torch这个组件没有安装吧。自己检查你的 pip list。发现的确是的。有很多人会说,我torch也装了,没用啊。那么再次运行pip install basicsr==1.4.2看看你的报错:

subprocess.CalledProcessError: Command '['/root/anaconda3/envs/sdweb/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpz6aq6i3c', '--quiet', '--index-url', 'http://mirrors.cloud.aliyuncs.com/pypi/simple/', 'cython']' returned non-zero exit status 1.

是不是 cython 没装?继续 pip install  cython。之后再 pip install basicsr==1.4.2 。一切顺利。

Using cached http://mirrors.cloud.aliyuncs.com/pypi/packages/d9/66/48866fc6b158c81cc2bfecc04c480f105c6040e8b077bc54c634b4a67926/zipp-3.17.0-py3-none-any.whl (7.4 kB) Requirement already satisfied: MarkupSafe>=2.1.1 in /root/anaconda3/envs/sdweb/lib/python3.9/site-packages (from werkzeug>=1.0.1->tb-nightly->basicsr==1.4.2) (2.1.3) Requirement already satisfied: mpmath>=0.19 in /root/anaconda3/envs/sdweb/lib/python3.9/site-packages (from sympy->torch>=1.7->basicsr==1.4.2) (1.3.0) Collecting pyasn1<0.6.0,>=0.4.6 (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tb-nightly->basicsr==1.4.2) Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/14/e5/b56a725cbde139aa960c26a1a3ca4d4af437282e20b5314ee6a3501e7dfc/pyasn1-0.5.0-py2.py3-none-any.whl (83 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.9/83.9 kB 20.8 MB/s eta 0:00:00 Collecting oauthlib>=3.0.0 (from requests-oauthlib>=0.7.0->google-auth-oauthlib<2,>=0.5->tb-nightly->basicsr==1.4.2) Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/7e/80/cab10959dc1faead58dc8384a781dfbf93cb4d33d50988f7a69f1b7c9bbe/oauthlib-3.2.2-py3-none-any.whl (151 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.7/151.7 kB 34.3 MB/s eta 0:00:00 Building wheels for collected packages: basicsr, future Building wheel for basicsr (setup.py) ... done Created wheel for basicsr: filename=basicsr-1.4.2-py3-none-any.whl size=214815 sha256=ecda099b53fed98a1b8de7f5d664e7cb5b87aa61f460da8398451fef37ae1dda Stored in directory: /root/.cache/pip/wheels/98/82/95/c5c4be83060c71d56847253c82403d8e3ce41f593497464000 Building wheel for future (setup.py) ... done Created wheel for future: filename=future-0.18.3-py3-none-any.whl size=492024 sha256=a342363c0af1ee27b6e02e270b787ee6b8d7da40e0c93bb53068542d30e4987f Stored in directory: /root/.cache/pip/wheels/ba/c0/e0/062cf9e3628c8943f1c665085c6c461e48a031ec8073514cf9 Successfully built basicsr future Installing collected packages: lmdb, addict, zipp, werkzeug, urllib3, tqdm, tomli, tifffile, tensorboard-data-server, six, scipy, pyyaml, pyasn1, protobuf, platformdirs, Pillow, packaging, opencv-python, oauthlib, lazy_loader, idna, grpcio, future, charset-normalizer, certifi, cachetools, absl-py, rsa, requests, pyasn1-modules, importlib-metadata, imageio, yapf, scikit-image, requests-oauthlib, markdown, google-auth, torchvision, google-auth-oauthlib, tb-nightly, basicsr Successfully installed Pillow-10.1.0 absl-py-2.0.0 addict-2.4.0 basicsr-1.4.2 cachetools-5.3.1 certifi-2023.7.22 charset-normalizer-3.3.0 future-0.18.3 google-auth-2.23.3 google-auth-oauthlib-1.1.0 grpcio-1.59.0 idna-3.4 imageio-2.31.5 importlib-metadata-6.8.0 lazy_loader-0.3 lmdb-1.4.1 markdown-3.5 oauthlib-3.2.2 opencv-python-4.8.1.78 packaging-23.2 platformdirs-3.11.0 protobuf-4.23.4 pyasn1-0.5.0 pyasn1-modules-0.3.0 pyyaml-6.0.1 requests-2.31.0 requests-oauthlib-1.3.1 rsa-4.9 scikit-image-0.22.0 scipy-1.11.3 six-1.16.0 tb-nightly-2.15.0a20231018 tensorboard-data-server-0.7.1 tifffile-2023.9.26 tomli-2.0.1 torchvision-0.16.0 tqdm-4.66.1 urllib3-2.0.7 werkzeug-3.0.0 yapf-0.40.2 zipp-3.17.0

后记:有些时候遇到问题实在没有办法的时候。慢慢分析解决问题是一种思路。

你可能感兴趣的:(python)