简体   繁体   中英

Pipenv fails locking when installing TensorFlow 2.4.1

2021-02-06: I ended up with installing TensorFlow using pip .

The original question is shown below.

As I mentioned in the title, pipenv fails to lock when installing TensorFlow (ver. 2.4.1). I would like to know the solution for this problem.

The current environment is:
macOS Big Sur 11.1
python 3.8.7 (pyenv-installed)
pyenv 1.2.22 (homebrew-installed)
pipenv 2020.11.15 (homebrew-installed)
pip 21.0

What I did and responses are:

  1. mkdir ~/tf && cd ~/tf
  2. pyenv local 3.8.7 -> changes to python 3.8.7
  3. pipenv --python 3.8.7 -> creates the virtual environment and Pipfile
  4. pipenv shell
  5. pip install --upgrade pip -> upgrades pip from 20.2.4 to 21.0
  6. 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?

I tried pipenv lock --clear , but it did not work and returned the same error message above.

It seems that TensorFlow is successfully installed since python -c 'import tensorflow as tf; print(tf.__version__)' python -c 'import tensorflow as tf; print(tf.__version__)' returns 2.4.1 , and its version supports Python 3.8.7. I also tried installing TensorFlow using pip outside the virtual environment, and it successfully installed TensorFlow 2.4.1.

Here is the result of pipenv graph and it seems there is no dependency conflict (there might be conflicts that I do not notice).

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]

If you have experienced the same issue and solved it, please let me know how to solve this problem. Thank you.

I don't know if you were able to resolve this. But I was stuck with the same issue. A simple pipenv clear and then a pipenv sync (which reinstalls dependencies from the pipfile) help resolving the issue Eventually pip lock was successfull

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM