Pipenv 在安装 TensorFlow 2.4.1 时锁定失败
Pipenv fails locking when installing TensorFlow 2.4.1
2021-02-06:我最终使用 pip
.
安装了 TensorFlow
原题如下图
正如我在标题中提到的,pipenv 在安装 TensorFlow(版本 2.4.1)时无法锁定。
我想知道这个问题的解决方案。
当前环境为:
macOS Big Sur 11.1
python3.8.7 (pyenv-installed)
pyenv 1.2.22 (homebrew-installed)
pipenv 2020.11.15 (homebrew-installed)
点 21.0
我所做的和回应是:
mkdir ~/tf && cd ~/tf
pyenv local 3.8.7
-> 更改为 python 3.8.7
pipenv --python 3.8.7
-> 创建虚拟环境和 Pipfile
pipenv shell
pip install --upgrade pip
-> 将 pip 从 20.2.4 升级到 21.0
pipenv install tensorflow
->
Installing tensorflow...
Adding tensorflow to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 741, in _main
[ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 702, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 684, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 1395, in resolve_deps
[ResolutionFailure]: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 1108, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 833, in resolve
[ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: Could not find a version that matches tensorflow (from -r /var/folders/66/qc27xk113h97ysq8g96dq6lw0000gn/T/pipenvi9b634u2requirements/pipenv-rgesnhxh-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
我尝试了pipenv lock --clear
,但没有成功,并返回了与上面相同的错误信息。
看来TensorFlow从python -c 'import tensorflow as tf; print(tf.__version__)'
returns2.4.1
开始安装成功,版本支持Python3.8.7。
我还尝试在虚拟环境外使用 pip
安装 TensorFlow,它成功安装了 TensorFlow 2.4.1.
这是pipenv graph
的结果,似乎没有依赖冲突(可能有我没有注意到的冲突)。
tensorflow==2.4.1
- absl-py [required: ~=0.10, installed: 0.11.0]
- six [required: Any, installed: 1.15.0]
- astunparse [required: ~=1.6.3, installed: 1.6.3]
- six [required: >=1.6.1,<2.0, installed: 1.15.0]
- wheel [required: >=0.23.0,<1.0, installed: 0.36.2]
- flatbuffers [required: ~=1.12.0, installed: 1.12]
- gast [required: ==0.3.3, installed: 0.3.3]
- google-pasta [required: ~=0.2, installed: 0.2.0]
- six [required: Any, installed: 1.15.0]
- grpcio [required: ~=1.32.0, installed: 1.32.0]
- six [required: >=1.5.2, installed: 1.15.0]
- h5py [required: ~=2.10.0, installed: 2.10.0]
- numpy [required: >=1.7, installed: 1.19.5]
- six [required: Any, installed: 1.15.0]
- keras-preprocessing [required: ~=1.1.2, installed: 1.1.2]
- numpy [required: >=1.9.1, installed: 1.19.5]
- six [required: >=1.9.0, installed: 1.15.0]
- numpy [required: ~=1.19.2, installed: 1.19.5]
- opt-einsum [required: ~=3.3.0, installed: 3.3.0]
- numpy [required: >=1.7, installed: 1.19.5]
- protobuf [required: >=3.9.2, installed: 3.14.0]
- six [required: >=1.9, installed: 1.15.0]
- six [required: ~=1.15.0, installed: 1.15.0]
- tensorboard [required: ~=2.4, installed: 2.4.1]
- absl-py [required: >=0.4, installed: 0.11.0]
- six [required: Any, installed: 1.15.0]
- google-auth [required: >=1.6.3,<2, installed: 1.24.0]
- cachetools [required: >=2.0.0,<5.0, installed: 4.2.1]
- pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
- pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
- rsa [required: >=3.1.4,<5, installed: 4.7]
- pyasn1 [required: >=0.1.3, installed: 0.4.8]
- setuptools [required: >=40.3.0, installed: 50.3.2]
- six [required: >=1.9.0, installed: 1.15.0]
- google-auth-oauthlib [required: >=0.4.1,<0.5, installed: 0.4.2]
- google-auth [required: Any, installed: 1.24.0]
- cachetools [required: >=2.0.0,<5.0, installed: 4.2.1]
- pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
- pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
- rsa [required: >=3.1.4,<5, installed: 4.7]
- pyasn1 [required: >=0.1.3, installed: 0.4.8]
- setuptools [required: >=40.3.0, installed: 50.3.2]
- six [required: >=1.9.0, installed: 1.15.0]
- requests-oauthlib [required: >=0.7.0, installed: 1.3.0]
- oauthlib [required: >=3.0.0, installed: 3.1.0]
- requests [required: >=2.0.0, installed: 2.25.1]
- certifi [required: >=2017.4.17, installed: 2020.12.5]
- chardet [required: >=3.0.2,<5, installed: 4.0.0]
- idna [required: >=2.5,<3, installed: 2.10]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.3]
- grpcio [required: >=1.24.3, installed: 1.32.0]
- six [required: >=1.5.2, installed: 1.15.0]
- markdown [required: >=2.6.8, installed: 3.3.3]
- numpy [required: >=1.12.0, installed: 1.19.5]
- protobuf [required: >=3.6.0, installed: 3.14.0]
- six [required: >=1.9, installed: 1.15.0]
- requests [required: >=2.21.0,<3, installed: 2.25.1]
- certifi [required: >=2017.4.17, installed: 2020.12.5]
- chardet [required: >=3.0.2,<5, installed: 4.0.0]
- idna [required: >=2.5,<3, installed: 2.10]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.3]
- setuptools [required: >=41.0.0, installed: 50.3.2]
- six [required: >=1.10.0, installed: 1.15.0]
- tensorboard-plugin-wit [required: >=1.6.0, installed: 1.8.0]
- werkzeug [required: >=0.11.15, installed: 1.0.1]
- wheel [required: >=0.26, installed: 0.36.2]
- tensorflow-estimator [required: >=2.4.0,<2.5.0, installed: 2.4.0]
- termcolor [required: ~=1.1.0, installed: 1.1.0]
- typing-extensions [required: ~=3.7.4, installed: 3.7.4.3]
- wheel [required: ~=0.35, installed: 0.36.2]
- wrapt [required: ~=1.12.1, installed: 1.12.1]
如果您遇到同样的问题并解决了,请告诉我如何解决这个问题。
谢谢。
我不知道你是否能够解决这个问题。但我遇到了同样的问题。
一个简单的 pipenv clear 然后一个 pipenv sync(从 pipfile 重新安装依赖项)有助于解决这个问题
最终 pip lock 成功了
我在 Big Sur 上遇到过许多关于 pipenv 的锁定问题。我已经能够通过 运行:
始终如一地解决它们(包括这个 TF 安装问题)
export SYSTEM_VERSION_COMPAT=1
在使用 pipenv 做任何事情之前。
从本质上讲,它让您的 shell 将自己标识为 Catalina to pipenv。
我放弃了用Pipenv安装TF,而是用pip安装了TF。
正如 TF 官网所建议的那样,使用 pip 安装 TF 可能是最好的解决方案。
谢谢。
2021-02-06:我最终使用 pip
.
原题如下图
正如我在标题中提到的,pipenv 在安装 TensorFlow(版本 2.4.1)时无法锁定。 我想知道这个问题的解决方案。
当前环境为:
macOS Big Sur 11.1
python3.8.7 (pyenv-installed)
pyenv 1.2.22 (homebrew-installed)
pipenv 2020.11.15 (homebrew-installed)
点 21.0
我所做的和回应是:
mkdir ~/tf && cd ~/tf
pyenv local 3.8.7
-> 更改为 python 3.8.7pipenv --python 3.8.7
-> 创建虚拟环境和 Pipfilepipenv shell
pip install --upgrade pip
-> 将 pip 从 20.2.4 升级到 21.0pipenv install tensorflow
->
Installing tensorflow...
Adding tensorflow to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 741, in _main
[ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 702, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 684, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 1395, in resolve_deps
[ResolutionFailure]: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 1108, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 833, in resolve
[ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: Could not find a version that matches tensorflow (from -r /var/folders/66/qc27xk113h97ysq8g96dq6lw0000gn/T/pipenvi9b634u2requirements/pipenv-rgesnhxh-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
我尝试了pipenv lock --clear
,但没有成功,并返回了与上面相同的错误信息。
看来TensorFlow从python -c 'import tensorflow as tf; print(tf.__version__)'
returns2.4.1
开始安装成功,版本支持Python3.8.7。
我还尝试在虚拟环境外使用 pip
安装 TensorFlow,它成功安装了 TensorFlow 2.4.1.
这是pipenv graph
的结果,似乎没有依赖冲突(可能有我没有注意到的冲突)。
tensorflow==2.4.1
- absl-py [required: ~=0.10, installed: 0.11.0]
- six [required: Any, installed: 1.15.0]
- astunparse [required: ~=1.6.3, installed: 1.6.3]
- six [required: >=1.6.1,<2.0, installed: 1.15.0]
- wheel [required: >=0.23.0,<1.0, installed: 0.36.2]
- flatbuffers [required: ~=1.12.0, installed: 1.12]
- gast [required: ==0.3.3, installed: 0.3.3]
- google-pasta [required: ~=0.2, installed: 0.2.0]
- six [required: Any, installed: 1.15.0]
- grpcio [required: ~=1.32.0, installed: 1.32.0]
- six [required: >=1.5.2, installed: 1.15.0]
- h5py [required: ~=2.10.0, installed: 2.10.0]
- numpy [required: >=1.7, installed: 1.19.5]
- six [required: Any, installed: 1.15.0]
- keras-preprocessing [required: ~=1.1.2, installed: 1.1.2]
- numpy [required: >=1.9.1, installed: 1.19.5]
- six [required: >=1.9.0, installed: 1.15.0]
- numpy [required: ~=1.19.2, installed: 1.19.5]
- opt-einsum [required: ~=3.3.0, installed: 3.3.0]
- numpy [required: >=1.7, installed: 1.19.5]
- protobuf [required: >=3.9.2, installed: 3.14.0]
- six [required: >=1.9, installed: 1.15.0]
- six [required: ~=1.15.0, installed: 1.15.0]
- tensorboard [required: ~=2.4, installed: 2.4.1]
- absl-py [required: >=0.4, installed: 0.11.0]
- six [required: Any, installed: 1.15.0]
- google-auth [required: >=1.6.3,<2, installed: 1.24.0]
- cachetools [required: >=2.0.0,<5.0, installed: 4.2.1]
- pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
- pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
- rsa [required: >=3.1.4,<5, installed: 4.7]
- pyasn1 [required: >=0.1.3, installed: 0.4.8]
- setuptools [required: >=40.3.0, installed: 50.3.2]
- six [required: >=1.9.0, installed: 1.15.0]
- google-auth-oauthlib [required: >=0.4.1,<0.5, installed: 0.4.2]
- google-auth [required: Any, installed: 1.24.0]
- cachetools [required: >=2.0.0,<5.0, installed: 4.2.1]
- pyasn1-modules [required: >=0.2.1, installed: 0.2.8]
- pyasn1 [required: >=0.4.6,<0.5.0, installed: 0.4.8]
- rsa [required: >=3.1.4,<5, installed: 4.7]
- pyasn1 [required: >=0.1.3, installed: 0.4.8]
- setuptools [required: >=40.3.0, installed: 50.3.2]
- six [required: >=1.9.0, installed: 1.15.0]
- requests-oauthlib [required: >=0.7.0, installed: 1.3.0]
- oauthlib [required: >=3.0.0, installed: 3.1.0]
- requests [required: >=2.0.0, installed: 2.25.1]
- certifi [required: >=2017.4.17, installed: 2020.12.5]
- chardet [required: >=3.0.2,<5, installed: 4.0.0]
- idna [required: >=2.5,<3, installed: 2.10]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.3]
- grpcio [required: >=1.24.3, installed: 1.32.0]
- six [required: >=1.5.2, installed: 1.15.0]
- markdown [required: >=2.6.8, installed: 3.3.3]
- numpy [required: >=1.12.0, installed: 1.19.5]
- protobuf [required: >=3.6.0, installed: 3.14.0]
- six [required: >=1.9, installed: 1.15.0]
- requests [required: >=2.21.0,<3, installed: 2.25.1]
- certifi [required: >=2017.4.17, installed: 2020.12.5]
- chardet [required: >=3.0.2,<5, installed: 4.0.0]
- idna [required: >=2.5,<3, installed: 2.10]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.3]
- setuptools [required: >=41.0.0, installed: 50.3.2]
- six [required: >=1.10.0, installed: 1.15.0]
- tensorboard-plugin-wit [required: >=1.6.0, installed: 1.8.0]
- werkzeug [required: >=0.11.15, installed: 1.0.1]
- wheel [required: >=0.26, installed: 0.36.2]
- tensorflow-estimator [required: >=2.4.0,<2.5.0, installed: 2.4.0]
- termcolor [required: ~=1.1.0, installed: 1.1.0]
- typing-extensions [required: ~=3.7.4, installed: 3.7.4.3]
- wheel [required: ~=0.35, installed: 0.36.2]
- wrapt [required: ~=1.12.1, installed: 1.12.1]
如果您遇到同样的问题并解决了,请告诉我如何解决这个问题。 谢谢。
我不知道你是否能够解决这个问题。但我遇到了同样的问题。 一个简单的 pipenv clear 然后一个 pipenv sync(从 pipfile 重新安装依赖项)有助于解决这个问题 最终 pip lock 成功了
我在 Big Sur 上遇到过许多关于 pipenv 的锁定问题。我已经能够通过 运行:
始终如一地解决它们(包括这个 TF 安装问题)export SYSTEM_VERSION_COMPAT=1
在使用 pipenv 做任何事情之前。
从本质上讲,它让您的 shell 将自己标识为 Catalina to pipenv。
我放弃了用Pipenv安装TF,而是用pip安装了TF。 正如 TF 官网所建议的那样,使用 pip 安装 TF 可能是最好的解决方案。 谢谢。