无法安装重采样

问题描述

Ubuntu 20.04.2 我在 virtualenv 中使用 python2.7(因为我试图构建的程序不适用于我的 3.8) 点子 20.3.4

我试图运行的程序(涉及 tensorflow)附带了一个包含所有需要安装的东西的文件(我认为这是一个 dockerfile?)。当我尝试运行该程序时,我收到有关 dockerfile 中的一项的错误 -- resampy。

我得到一个 ImportError:No module resampy

我做了一个pip install resampy

DEPRECATION: Python 2.7 reached the end of its life on January 1st,2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Processing /home/pete/.cache/pip/wheels/19/90/bb/f45e7cc1cfc8f5299c12511fccefcca90c801de995a4e7eb00/resampy-0.2.2-py2-none-any.whl
Collecting numba>=0.32
  Using cached numba-0.47.0-cp27-cp27mu-manylinux1_x86_64.whl (3.6 MB)
Requirement already satisfied: numpy>=1.10 in /home/pete/env/py2.7/lib/python2.7/site-packages (from resampy) (1.13.1)
Requirement already satisfied: scipy>=0.13 in /home/pete/env/py2.7/lib/python2.7/site-packages (from resampy) (0.19.1)
Requirement already satisfied: six>=1.3 in /home/pete/env/py2.7/lib/python2.7/site-packages (from resampy) (1.11.0)
Requirement already satisfied: singledispatch; python_version < "3.4" in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (3.4.0.3)
Collecting llvmlite>=0.31.0dev0
  Using cached llvmlite-0.32.1.tar.gz (104 kB)
Requirement already satisfied: setuptools in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (44.1.1)
Requirement already satisfied: funcsigs; python_version < "3.3" in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (1.0.2)
Requirement already satisfied: enum34; python_version < "3.4" in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (1.1.10)
Building wheels for collected packages: llvmlite
  Building wheel for llvmlite (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/pete/env/py2.7/bin/python -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-UP2Yh4/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-UP2Yh4/llvmlite/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ZIPpvD
       cwd: /tmp/pip-install-UP2Yh4/llvmlite/
  Complete output (7 lines):
  running bdist_wheel
  /home/pete/env/py2.7/bin/python /tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py
    File "/tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py",line 122
      raise ValueError(msg.format(_ver_check_skip)) from e
                                                       ^
  SyntaxError: invalid syntax
  error: command '/home/pete/env/py2.7/bin/python' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build llvmlite
Installing collected packages: llvmlite,numba,resampy
    Running setup.py install for llvmlite ... error
    ERROR: Command errored out with exit status 1:
     command: /home/pete/env/py2.7/bin/python -u -c 'import sys,'"'"'exec'"'"'))' install --record /tmp/pip-record-j9jtLs/install-record.txt --single-version-externally-managed --compile --install-headers /home/pete/env/py2.7/include/site/python2.7/llvmlite
         cwd: /tmp/pip-install-UP2Yh4/llvmlite/
    Complete output (10 lines):
    running install
    running build
    got version from file /tmp/pip-install-UP2Yh4/llvmlite/llvmlite/_version.py {'version': '0.32.1','full': 'aa11b129c0b55973067422397821ae6d44fa5e70'}
    running build_ext
    /home/pete/env/py2.7/bin/python /tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py
      File "/tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py",line 122
        raise ValueError(msg.format(_ver_check_skip)) from e
                                                         ^
    SyntaxError: invalid syntax
    error: command '/home/pete/env/py2.7/bin/python' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/pete/env/py2.7/bin/python -u -c 'import sys,'"'"'exec'"'"'))' install --record /tmp/pip-record-j9jtLs/install-record.txt --single-version-externally-managed --compile --install-headers /home/pete/env/py2.7/include/site/python2.7/llvmlite Check the logs for full command output.

我尝试了 pip3 install resampy,结果看起来更好:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: resampy in /usr/local/lib/python3.8/dist-packages (0.2.2)
Requirement already satisfied: numba>=0.32 in /usr/local/lib/python3.8/dist-packages (from resampy) (0.52.0)
Requirement already satisfied: scipy>=0.13 in /usr/local/lib/python3.8/dist-packages (from resampy) (1.6.0)
Requirement already satisfied: numpy>=1.10 in /home/pete/.local/lib/python3.8/site-packages (from resampy) (1.19.4)
Requirement already satisfied: six>=1.3 in /usr/lib/python3/dist-packages (from resampy) (1.14.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from numba>=0.32->resampy) (45.2.0)
Requirement already satisfied: llvmlite<0.36,>=0.35.0 in /usr/local/lib/python3.8/dist-packages (from numba>=0.32->resampy) (0.35.0)
WARNING: You are using pip version 20.3.3; however,version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

没有错误。但是当我尝试运行我试图运行的程序时,我仍然得到原始的 ImportError

我承认我在这里过头了。我基本上只有中等水平的 Python 知识/经验。我什至不知道“轮子”是什么,我在里面找不到任何东西,因为“轮子”在谷歌上很难找到关于轮胎之类的东西。因此,即使只是了解“轮子”是什么的指针也会有所帮助。

谢谢!

解决方法

我之前试过py27安装也失败了。

但是你可以通过 py38 安装它

pip install resampy

你可以测试一下

pip install -e .[tests]
pip install pytest pytest-cov pytest-faulthandler
py.test --cov-report term-missing --cov resampy

结果: enter image description here

至于ImportError,一旦你成功安装它,它对我来说效果很好: enter image description here

,

不妨试试这个

pip install llvmlite==0.31.0

pip install resampy

就我而言,当前的 llvmlite 软件包版本使其崩溃。但是resampy需要这个包。

您也可以尝试早期版本的 resampy,它独立于 llvmlite

pip install resampy==0.1.5

祝你好运

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...