【问题标题】:Python Conda determining what Python version to installPython Conda 确定要安装的 Python 版本
【发布时间】:2022-08-14 08:40:11
【问题描述】:

当我尝试使用 Conda 安装 librosa 软件包时,出现以下错误:

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - librosa -> python[version=\'>=2.7,<2.8.0a0|>=2.7|>=3.10,<3.11.0a0|>=3.10,<3.11.0a0|>=3.5|>=3.7|>=3.9,<3.10.0a0|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.7,<3.8.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0\',build=\'*_73_pypy|*_cpython|*_cpython|*_cpython|*_73_pypy|*_cpython|*_73_pypy\']

Your python: python=3.9

If python is on the left-most side of the chain, that\'s the version you\'ve asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

我可以知道如何理解规格吗?因为它提到的Python版本太多了,我不明白的是我怎么知道Python在链的最左边或者python出现在这句话的右边:

如果 python 在链的最左侧,那就是您要求的版本。 当python出现在右边时,这表明左边的东西不知何故 不适用于您受限的 python 版本。

从错误消息中,我如何确定可以安装哪个版本? 我可以知道我应该安装哪个 python 版本以避免 Python 不兼容错误吗?

以下是我目前已安装的所有软件包:

# Name                    Version                   Build  Channel
_openmp_mutex             4.5                       2_gnu    conda-forge
_tflow_select             2.3.0                       mkl    anaconda
abseil-cpp                20200923.3           h01db608_0    conda-forge
absl-py                   1.2.0              pyhd8ed1ab_0    conda-forge
aiohttp                   3.8.1            py39h0fd3b05_1    conda-forge
aiosignal                 1.2.0              pyhd8ed1ab_0    conda-forge
astor                     0.8.1              pyh9f0ad1d_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
async-timeout             4.0.2              pyhd8ed1ab_0    conda-forge
attrs                     22.1.0             pyh71513ae_1    conda-forge
blinker                   1.4                        py_1    conda-forge
brotlipy                  0.7.0           py39h0fd3b05_1004    conda-forge
bzip2                     1.0.8                hf897c2e_4    conda-forge
c-ares                    1.18.1               hf897c2e_0    conda-forge
ca-certificates           2022.6.15            h4fd8a4c_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                4.2.4              pyhd8ed1ab_0    conda-forge
certifi                   2022.6.15        py39h4420490_0    conda-forge
cffi                      1.15.1           py39hb26bf21_0    conda-forge
charset-normalizer        2.1.0              pyhd8ed1ab_0    conda-forge
click                     8.1.3            py39h4420490_0    conda-forge
cryptography              37.0.4           py39h32042e6_0    conda-forge
flatbuffers               2.0.6                h4de3ea5_0    conda-forge
frozenlist                1.3.1            py39h0fd3b05_0    conda-forge
gast                      0.4.0              pyh9f0ad1d_0    conda-forge
giflib                    5.2.1                hb9de7d4_2    conda-forge
google-auth               1.35.0             pyh6c4a22f_0    conda-forge
google-auth-oauthlib      0.4.6              pyhd8ed1ab_0    conda-forge
google-pasta              0.2.0              pyh8c360ce_0    conda-forge
grpcio                    1.46.3           py39h8a0731a_0    conda-forge
h5py                      3.6.0           nompi_py39hbdd1fc2_100    conda-for                                                                                ge
hdf5                      1.12.1          nompi_h7bde11e_104    conda-forge
icu                       68.2                 h3621d8e_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.4           py39ha65689a_0    conda-forge
jpeg                      9e                   h9cdd2b7_2    conda-forge
keras                     2.4.3              pyhd8ed1ab_0    conda-forge
keras-preprocessing       1.1.2              pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h4e544f5_0    conda-forge
krb5                      1.19.3               h7c456eb_0    conda-forge
ld_impl_linux-aarch64     2.36.1               h02ad14f_2    conda-forge
libblas                   3.9.0           16_linuxaarch64_openblas    conda-f                                                                                orge
libcblas                  3.9.0           16_linuxaarch64_openblas    conda-f                                                                                orge
libcurl                   7.83.1               h8fd98b7_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h3557bc0_5    conda-forge
libgcc-ng                 12.1.0              h3242a24_16    conda-forge
libgfortran-ng            12.1.0              he9431aa_16    conda-forge
libgfortran5              12.1.0              h41d5c85_16    conda-forge
libgomp                   12.1.0              h3242a24_16    conda-forge
liblapack                 3.9.0           16_linuxaarch64_openblas    conda-f                                                                                orge
libnghttp2                1.47.0               h75cb1c7_0    conda-forge
libnsl                    2.0.0                hf897c2e_0    conda-forge
libopenblas               0.3.21          pthreads_h6cb6f83_0    conda-forge
libpng                    1.6.37               hf9034f9_3    conda-forge
libprotobuf               3.14.0               hc71ff50_0    conda-forge
libssh2                   1.10.0               h1ab2c7b_2    conda-forge
libstdcxx-ng              12.1.0              hd01590b_16    conda-forge
libuuid                   2.32.1            hf897c2e_1000    conda-forge
libzlib                   1.2.12               h4e544f5_2    conda-forge
markdown                  3.4.1              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.1            py39hb9a1dbb_1    conda-forge
multidict                 6.0.2            py39h0fd3b05_1    conda-forge
ncurses                   6.3                  headf329_1    conda-forge
numpy                     1.23.1           py39h7190128_0    conda-forge
oauthlib                  3.2.0              pyhd8ed1ab_0    conda-forge
openssl                   1.1.1q               h4e544f5_0    conda-forge
opt_einsum                3.3.0              pyhd8ed1ab_1    conda-forge
pip                       22.2.2             pyhd8ed1ab_0    conda-forge
protobuf                  3.14.0           py39h99ab00b_1    conda-forge
pyasn1                    0.4.8                      py_0    conda-forge
pyasn1-modules            0.2.7                      py_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyjwt                     2.4.0              pyhd8ed1ab_0    conda-forge
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1            py39ha65689a_5    conda-forge
python                    3.9.13          h2eada40_0_cpython    conda-forge
python-flatbuffers        1.12               pyhd8ed1ab_1    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pyu2f                     0.1.5              pyhd8ed1ab_0    conda-forge
pyyaml                    6.0              py39h0fd3b05_4    conda-forge
readline                  8.1.2                h38e3740_0    conda-forge
requests                  2.28.1             pyhd8ed1ab_0    conda-forge
requests-oauthlib         1.3.1              pyhd8ed1ab_0    conda-forge
rsa                       4.9                pyhd8ed1ab_0    conda-forge
scipy                     1.9.0            py39h7b076ec_0    conda-forge
setuptools                64.0.1           py39ha65689a_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.9                hc7e91e1_1    conda-forge
sqlite                    3.39.2               hc74f5b8_0    conda-forge
tensorboard               2.5.0              pyhd8ed1ab_1    conda-forge
tensorboard-data-server   0.6.0            py39h3144da0_0    anaconda
tensorboard-plugin-wit    1.8.1              pyhd8ed1ab_0    conda-forge
tensorflow                2.5.0           mkl_py39h22df468_0    anaconda
tensorflow-base           2.5.0           mkl_py39ha7bf56e_0    anaconda
tensorflow-estimator      2.5.0              pyh81a9013_1    conda-forge
termcolor                 1.1.0              pyhd8ed1ab_3    conda-forge
tk                        8.6.12               hd8af866_0    conda-forge
typing-extensions         4.3.0                hd8ed1ab_0    conda-forge
typing_extensions         4.3.0              pyha770c72_0    conda-forge
tzdata                    2022b                h191b570_0    conda-forge
urllib3                   1.26.11            pyhd8ed1ab_0    conda-forge
werkzeug                  2.2.2              pyhd8ed1ab_0    conda-forge
wheel                     0.35.1             pyh9f0ad1d_0    conda-forge
wrapt                     1.14.1           py39h0fd3b05_0    conda-forge
xz                        5.2.5                h6dd45c4_1    conda-forge
yaml                      0.2.5                hf897c2e_2    conda-forge
yarl                      1.7.2            py39h0fd3b05_2    conda-forge
zipp                      3.8.1              pyhd8ed1ab_0    conda-forge
zlib                      1.2.12               h4e544f5_2    conda-forge
  • 我会选择最稳定的 Python 版本。 Python 2 为 2.7,Python 3 为 3.7conda create -n myenv python=3.7
  • 我认为python的最新稳定版本是3.10.6。根据经验,我会更新,我认为它会解决这个问题,尽管 python 要求很奇怪 IMO
  • 您可以使用 conda docs.conda.io/projects/conda/en/latest/user-guide/… 安装不同的版本,即 2.7 和 3.6。它应该适用于2.7
  • @Susan 那么我会尝试使用3.10.5
  • how to read specifications 它确实解释了特定的包要求以及如何阅读这些要求。

标签: python conda librosa


【解决方案1】:

主要架构

绝对不会和 Python 版本冲突。例如,以下所有解决方案对我来说都没有问题:

CONDA_SUBDIR=linux-64 conda create -dn foo python=3.9 librosa
CONDA_SUBDIR=osx-64 conda create -dn foo python=3.9 librosa
CONDA_SUBDIR=win-64 conda create -dn foo python=3.9 librosa

相反,Conda is notoriously bad 报告了为什么它不能解决问题。如果您有兴趣找出实际冲突的内容,我建议您尝试 Mamba:

conda install -n base -c conda-forge mamba
mamba install librosa

否则,如果您只关心使用librosa 启动和运行,那么创建一个新环境:

conda create -n whatever librosa python=3.9

并使用您想要的任何 Python 版本,尽管 3.8-3.10 是唯一的活动版本(3.7 处于仅安全模式,并在 2023 年 6 月达到 EOL)。


其他架构

但是,上述内容不适用于 OP 的情况,它正在解决linux-aarch64建筑学。 Conda Forge 尚未提供linux-aarch64audioread 构建,但您可以通过this repository 上的拉取请求通过adding it to the "arch_rebuild.txt" list 请求一个。1在这种特殊情况下,我恰好是该原料的维护者,因此我将直接进行并重新检查。

与此同时,Conda 确实可以选择在其求解器中考虑从 PyPI 安装的软件包。这个选项是:

% conda config --describe pip_interop_enabled
# # pip_interop_enabled (bool)
# #   Allow the conda solver to interact with non-conda-installed python
# #   packages.
# # 
# pip_interop_enabled: false

也就是说,您希望(至少暂时)使用:

conda config --set pip_interop_enabled true
pip install audioread
mamba install librosa

进一步的可能性

如果librosa 的其他依赖项也缺少,安装可能仍然无法正常工作linux-aarch64构建。在这种情况下,您必须request builds 或尝试通过pip install 安装。


[1]简而言之,编辑arch_rebuild.txt 文件以附加您想要为其构建的包名称aarch64.将此作为 PR 提交。

【讨论】:

  • 感谢您的意见。我可以知道如果我使用 mamba,我是否需要使用 mamba 安装所有软件包?或者我可以安装一些带有 mamba 的包和一些带有 conda 的包吗?我可以知道使用 mamba 和 conda 和 pip 有什么区别吗?
  • 当我使用 mamba 安装 librosa 时,出现此错误
  • Looking for: ['librosa'] conda-forge/linux-aarch64 Using cache conda-forge/noarch Using cache warning libmamba Could not parse mod/etag header anaconda/linux-aarch64 Using cache anaconda/noarch default/linux-aarch64 No change default/noarch No change
  • Pinned packages: - python 3.7.* Encountered problems while solving: - nothing provides audioread &gt;=2.0.0 needed by librosa-0.6.1-py_1 我可以知道问题是由于没有audioread>=2.0.0吗?我应该使用 conda 还是 mamba 安装 audioread=2.0.0?
  • 当我用 mamba mamba install audioread 安装 audioread 时,它说 Pinned packages: - python 3.7.* Encountered problems while solving: - nothing provides requested audioread 。所以我用 pip pip install audioread 安装 audioread。 Audioread 3.0.0 通过 pip 安装成功,而 conda 和 mamba 无法安装 audioread。之后,当我用 mamba 安装 librosa 时,我遇到了同样的问题 nothing provides audioread&gt;=2.0.0 needed by librosa-0.6.1-py_1。我可以知道如何解决能够安装 librosa 的问题吗?我正在使用linux aarch64。
猜你喜欢
  • 1970-01-01
  • 2022-01-06
  • 1970-01-01
  • 2019-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-06
  • 1970-01-01
相关资源
最近更新 更多