无法使用 pip 安装 Azure 包:ruamel.yaml 错误
Can't install Azure packages with pip: ruamel.yaml error
我在 Arch Linux.
上的新 python 3.9.7 虚拟环境中安装以下软件包时遇到问题
我的 requirements.txt 文件:
joblib
python-dotenv
azure-cli==2.29.2
azureml-core
重现步骤:
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install -r requirements.txt
这是最后一条命令输出的相关部分,在尝试安装时出错 ruamel.yaml
:
Using legacy 'setup.py install' for ruamel.yaml, since package 'wheel' is not installed.
Installing collected packages: pycparser, urllib3, idna, chardet, cffi, certifi, six, requests, PyJWT, oauthlib, cryptography, requests-oauthlib, python-dateutil, isodate, azure-nspkg, wrapt, tabulate, pyyaml, PySocks, pyopenssl, PyNaCl, pygments, portalocker, msrest, msal, MarkupSafe, jmespath, colorama, bcrypt, azure-mgmt-nspkg, azure-core, argcomplete, applicationinsights, adal, websocket-client, vsts, pyparsing, pyasn1, psutil, pkginfo, pathlib2, paramiko, msrestazure, msal-extensions, knack, jinja2, jeepney, invoke, humanfriendly, deprecated, backports.weakref, azure-mgmt-datalake-nspkg, azure-mgmt-core, azure-common, azure-cli-telemetry, xmltodict, sshtunnel, semver, SecretStorage, scp, ruamel.yaml, pytz, PyGithub, pathspec, packaging, ndg-httpsclient, jsonpickle, jsondiff, javaproperties, fabric, docker, distro, contextlib2, backports.tempfile, azure-synapse-spark, azure-synapse-managedprivateendpoints, azure-synapse-artifacts, azure-synapse-accesscontrol, azure-storage-common, azure-multiapi-storage, azure-mgmt-web, azure-mgmt-trafficmanager, azure-mgmt-synapse, azure-mgmt-storage, azure-mgmt-sqlvirtualmachine, azure-mgmt-sql, azure-mgmt-signalr, azure-mgmt-servicefabricmanagedclusters, azure-mgmt-servicefabric, azure-mgmt-servicebus, azure-mgmt-security, azure-mgmt-search, azure-mgmt-resource, azure-mgmt-reservations, azure-mgmt-relay, azure-mgmt-redis, azure-mgmt-redhatopenshift, azure-mgmt-recoveryservicesbackup, azure-mgmt-recoveryservices, azure-mgmt-rdbms, azure-mgmt-privatedns, azure-mgmt-policyinsights, azure-mgmt-network, azure-mgmt-netapp, azure-mgmt-msi, azure-mgmt-monitor, azure-mgmt-media, azure-mgmt-marketplaceordering, azure-mgmt-maps, azure-mgmt-managementgroups, azure-mgmt-managedservices, azure-mgmt-loganalytics, azure-mgmt-kusto, azure-mgmt-keyvault, azure-mgmt-iothubprovisioningservices, azure-mgmt-iothub, azure-mgmt-iotcentral, azure-mgmt-imagebuilder, azure-mgmt-hdinsight, azure-mgmt-extendedlocation, azure-mgmt-eventhub, azure-mgmt-eventgrid, azure-mgmt-dns, azure-mgmt-devtestlabs, azure-mgmt-deploymentmanager, azure-mgmt-datamigration, azure-mgmt-datalake-store, azure-mgmt-datalake-analytics, azure-mgmt-databoxedge, azure-mgmt-cosmosdb, azure-mgmt-containerservice, azure-mgmt-containerregistry, azure-mgmt-containerinstance, azure-mgmt-consumption, azure-mgmt-compute, azure-mgmt-cognitiveservices, azure-mgmt-cdn, azure-mgmt-botservice, azure-mgmt-billing, azure-mgmt-batchai, azure-mgmt-batch, azure-mgmt-authorization, azure-mgmt-applicationinsights, azure-mgmt-appconfiguration, azure-mgmt-apimanagement, azure-mgmt-advisor, azure-loganalytics, azure-keyvault-keys, azure-keyvault-administration, azure-keyvault, azure-identity, azure-graphrbac, azure-functions-devops-build, azure-datalake-store, azure-cosmos, azure-cli-core, azure-batch, azure-appconfiguration, antlr4-python3-runtime, python-dotenv, joblib, azureml-core, azure-cli
Running setup.py install for ruamel.yaml: started
Running setup.py install for ruamel.yaml: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8y_97owt/install-record.txt --single-version-externally-managed --compile --install-headers /home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/include/site/python3.9/ruamel.yaml
cwd: /tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/
Complete output (649 lines):
sys.argv ['/tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/setup.py', 'install', '--record', '/tmp/pip-record-8y_97owt/install-record.txt', '--single-version-externally-managed', '--compile', '--install-headers', '/home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/include/site/python3.9/ruamel.yaml']
test compiling test_ruamel_yaml
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/ruamel
copying .ruamel/__init__.py -> build/lib.linux-x86_64-3.9/ruamel
creating build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./main.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./util.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./tokens.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarfloat.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scanner.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./comments.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./loader.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./serializer.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./resolver.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./nodes.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./dumper.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./configobjwalker.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./timestamp.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./error.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./reader.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./cyaml.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./parser.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./__init__.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./representer.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./events.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarbool.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./composer.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarint.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./emitter.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./anchor.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./compat.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./constructor.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarstring.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./LICENSE -> build/lib.linux-x86_64-3.9/ruamel/yaml
running build_ext
building '_ruamel_yaml' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/ext
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -I/home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/include -I/usr/include/python3.9 -c ext/_ruamel_yaml.c -o build/temp.linux-x86_64-3.9/ext/_ruamel_yaml.o
In file included from ext/_ruamel_yaml.c:523:
ext/_ruamel_yaml.h:10: warning: "PyString_CheckExact" redefined
<a whole bunch of compiling errors & warnings>
可以找到完整的日志文件here
注意行 Using legacy 'setup.py install' for ruamel.yaml, since package 'wheel' is not installed.
。如果我先安装 wheel
包,安装包时会出现同样的错误。
手动安装ruamel.yaml
没问题,但是azure包还是安装不上。
编辑: 一个接一个地安装每一个包都可以毫无错误地安装所有的东西。为什么?
将第 3 步更改为 pip install -U pip wheel ruamel.yaml
不会改变任何内容。
ruamel.yaml
documentation 声明它应该使用以下方式安装:
pip install ruamel.yaml
因此不应使用遗留 [python] setup.py install
。
您的完整日志表明它试图安装两个版本的 ruamel.yaml:
Collecting ruamel.yaml<=0.17.16,>=0.17.10
Using cached ruamel.yaml-0.17.16-py3-none-any.whl (109 kB)
和
Collecting ruamel.yaml<=0.15.89,>=0.15.35
Using cached ruamel.yaml-0.15.89.tar.gz (306 kB)
除了安装两个版本的潜在问题外,第二个版本不会成功,因为 0.15 ruamel.yaml 系列(最后一个于 2019 年 7 月上传到 PyPI)不支持 Python 3.9 于 2020 年 10 月首次发布。
因此,当您逐步安装每个软件包时,您将获得最新版本或 ruamel.yaml。为什么分步安装不能与某些软件包一起尝试安装 ruamel.yaml==0.15.89
作为依赖项尚不清楚。
当我安装您 requirements.txt
中列出的四个软件包时,ruamel.yaml
没有安装,但 pipdeptree
表明 azureml-core==1.36.0.post2
可能存在相互冲突的依赖项。
当我使用你的 requirements.txt
时,我得到了同样的错误。
当我在 Python 3.7 venv
(以便可以安装旧的 ruamel.yaml 轮子)中使用您的 requirements.txt
时,安装工作正常。从那里你可以看到安装了包 azureml-core==1.14.0
而不是 azureml-core==1.36.0.post2
我在 Arch Linux.
上的新 python 3.9.7 虚拟环境中安装以下软件包时遇到问题我的 requirements.txt 文件:
joblib
python-dotenv
azure-cli==2.29.2
azureml-core
重现步骤:
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install -r requirements.txt
这是最后一条命令输出的相关部分,在尝试安装时出错 ruamel.yaml
:
Using legacy 'setup.py install' for ruamel.yaml, since package 'wheel' is not installed.
Installing collected packages: pycparser, urllib3, idna, chardet, cffi, certifi, six, requests, PyJWT, oauthlib, cryptography, requests-oauthlib, python-dateutil, isodate, azure-nspkg, wrapt, tabulate, pyyaml, PySocks, pyopenssl, PyNaCl, pygments, portalocker, msrest, msal, MarkupSafe, jmespath, colorama, bcrypt, azure-mgmt-nspkg, azure-core, argcomplete, applicationinsights, adal, websocket-client, vsts, pyparsing, pyasn1, psutil, pkginfo, pathlib2, paramiko, msrestazure, msal-extensions, knack, jinja2, jeepney, invoke, humanfriendly, deprecated, backports.weakref, azure-mgmt-datalake-nspkg, azure-mgmt-core, azure-common, azure-cli-telemetry, xmltodict, sshtunnel, semver, SecretStorage, scp, ruamel.yaml, pytz, PyGithub, pathspec, packaging, ndg-httpsclient, jsonpickle, jsondiff, javaproperties, fabric, docker, distro, contextlib2, backports.tempfile, azure-synapse-spark, azure-synapse-managedprivateendpoints, azure-synapse-artifacts, azure-synapse-accesscontrol, azure-storage-common, azure-multiapi-storage, azure-mgmt-web, azure-mgmt-trafficmanager, azure-mgmt-synapse, azure-mgmt-storage, azure-mgmt-sqlvirtualmachine, azure-mgmt-sql, azure-mgmt-signalr, azure-mgmt-servicefabricmanagedclusters, azure-mgmt-servicefabric, azure-mgmt-servicebus, azure-mgmt-security, azure-mgmt-search, azure-mgmt-resource, azure-mgmt-reservations, azure-mgmt-relay, azure-mgmt-redis, azure-mgmt-redhatopenshift, azure-mgmt-recoveryservicesbackup, azure-mgmt-recoveryservices, azure-mgmt-rdbms, azure-mgmt-privatedns, azure-mgmt-policyinsights, azure-mgmt-network, azure-mgmt-netapp, azure-mgmt-msi, azure-mgmt-monitor, azure-mgmt-media, azure-mgmt-marketplaceordering, azure-mgmt-maps, azure-mgmt-managementgroups, azure-mgmt-managedservices, azure-mgmt-loganalytics, azure-mgmt-kusto, azure-mgmt-keyvault, azure-mgmt-iothubprovisioningservices, azure-mgmt-iothub, azure-mgmt-iotcentral, azure-mgmt-imagebuilder, azure-mgmt-hdinsight, azure-mgmt-extendedlocation, azure-mgmt-eventhub, azure-mgmt-eventgrid, azure-mgmt-dns, azure-mgmt-devtestlabs, azure-mgmt-deploymentmanager, azure-mgmt-datamigration, azure-mgmt-datalake-store, azure-mgmt-datalake-analytics, azure-mgmt-databoxedge, azure-mgmt-cosmosdb, azure-mgmt-containerservice, azure-mgmt-containerregistry, azure-mgmt-containerinstance, azure-mgmt-consumption, azure-mgmt-compute, azure-mgmt-cognitiveservices, azure-mgmt-cdn, azure-mgmt-botservice, azure-mgmt-billing, azure-mgmt-batchai, azure-mgmt-batch, azure-mgmt-authorization, azure-mgmt-applicationinsights, azure-mgmt-appconfiguration, azure-mgmt-apimanagement, azure-mgmt-advisor, azure-loganalytics, azure-keyvault-keys, azure-keyvault-administration, azure-keyvault, azure-identity, azure-graphrbac, azure-functions-devops-build, azure-datalake-store, azure-cosmos, azure-cli-core, azure-batch, azure-appconfiguration, antlr4-python3-runtime, python-dotenv, joblib, azureml-core, azure-cli
Running setup.py install for ruamel.yaml: started
Running setup.py install for ruamel.yaml: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8y_97owt/install-record.txt --single-version-externally-managed --compile --install-headers /home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/include/site/python3.9/ruamel.yaml
cwd: /tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/
Complete output (649 lines):
sys.argv ['/tmp/pip-install-ouy4o2zq/ruamel-yaml_763ae0866f7e4425a0965a00130752b0/setup.py', 'install', '--record', '/tmp/pip-record-8y_97owt/install-record.txt', '--single-version-externally-managed', '--compile', '--install-headers', '/home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/include/site/python3.9/ruamel.yaml']
test compiling test_ruamel_yaml
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/ruamel
copying .ruamel/__init__.py -> build/lib.linux-x86_64-3.9/ruamel
creating build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./main.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./util.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./tokens.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarfloat.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scanner.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./comments.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./loader.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./serializer.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./resolver.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./nodes.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./dumper.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./configobjwalker.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./timestamp.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./error.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./reader.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./cyaml.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./parser.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./__init__.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./representer.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./events.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarbool.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./composer.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarint.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./emitter.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./anchor.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./compat.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./constructor.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./scalarstring.py -> build/lib.linux-x86_64-3.9/ruamel/yaml
copying ./LICENSE -> build/lib.linux-x86_64-3.9/ruamel/yaml
running build_ext
building '_ruamel_yaml' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/ext
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -I/home/zjeffer/Documents/school/howest-mct/semester5/mlops/labo/project/mlops-project/venv/include -I/usr/include/python3.9 -c ext/_ruamel_yaml.c -o build/temp.linux-x86_64-3.9/ext/_ruamel_yaml.o
In file included from ext/_ruamel_yaml.c:523:
ext/_ruamel_yaml.h:10: warning: "PyString_CheckExact" redefined
<a whole bunch of compiling errors & warnings>
可以找到完整的日志文件here
注意行 Using legacy 'setup.py install' for ruamel.yaml, since package 'wheel' is not installed.
。如果我先安装 wheel
包,安装包时会出现同样的错误。
手动安装ruamel.yaml
没问题,但是azure包还是安装不上。
编辑: 一个接一个地安装每一个包都可以毫无错误地安装所有的东西。为什么?
将第 3 步更改为 pip install -U pip wheel ruamel.yaml
不会改变任何内容。
ruamel.yaml
documentation 声明它应该使用以下方式安装:
pip install ruamel.yaml
因此不应使用遗留 [python] setup.py install
。
您的完整日志表明它试图安装两个版本的 ruamel.yaml:
Collecting ruamel.yaml<=0.17.16,>=0.17.10
Using cached ruamel.yaml-0.17.16-py3-none-any.whl (109 kB)
和
Collecting ruamel.yaml<=0.15.89,>=0.15.35
Using cached ruamel.yaml-0.15.89.tar.gz (306 kB)
除了安装两个版本的潜在问题外,第二个版本不会成功,因为 0.15 ruamel.yaml 系列(最后一个于 2019 年 7 月上传到 PyPI)不支持 Python 3.9 于 2020 年 10 月首次发布。
因此,当您逐步安装每个软件包时,您将获得最新版本或 ruamel.yaml。为什么分步安装不能与某些软件包一起尝试安装 ruamel.yaml==0.15.89
作为依赖项尚不清楚。
当我安装您 requirements.txt
中列出的四个软件包时,ruamel.yaml
没有安装,但 pipdeptree
表明 azureml-core==1.36.0.post2
可能存在相互冲突的依赖项。
当我使用你的 requirements.txt
时,我得到了同样的错误。
当我在 Python 3.7 venv
(以便可以安装旧的 ruamel.yaml 轮子)中使用您的 requirements.txt
时,安装工作正常。从那里你可以看到安装了包 azureml-core==1.14.0
而不是 azureml-core==1.36.0.post2