How to resolve Python package depencencies with pipenv?

后端 未结 12 2504
余生分开走
余生分开走 2020-12-13 06:35

I am using pipenv to handle a Python package dependencies.

The Python package is using two packages (named pckg1 and pckg2) that relies on

相关标签:
12条回答
  • 2020-12-13 06:42

    It happened the same to me, I'm working with Visual Studio Code and I was able to get rid o it:

    • remove all files except *.py from your python folder (.vscode, pycache, * virtual environments within that folder)
    • create a new virtualenv env(name)
    • new\scripts\activate.bat

    and then try to install the missing dependencies for the virtual folder and good to go, it worked for me.

    0 讨论(0)
  • 2020-12-13 06:44

    If you ran into the Locking Failed! error:

    Locking [dev-packages] dependencies…
    Locking [packages] dependencies…
    ✘ Locking Failed!
    

    clearing the cache on pipfile.lock, uninstalling your package and restarting the VM did the trick for me.

    Try:

    pipenv uninstall *YourPackage*
    pipenv uninstall *YourPackage* --dev   ##(if relevant to your package)
    pipenv lock --clear
    

    stop & destroy VMM

    restart VM

    0 讨论(0)
  • 2020-12-13 06:48

    I get that error constantly. Clearing the cache in the lock file works beautifully every time.

    $ pipenv lock --pre --clear

    0 讨论(0)
  • 2020-12-13 06:49
    pipenv lock
    Locking [dev-packages] dependencies…
    Locking [packages] dependencies…
    
    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.
    

    pipenv install --clean

    0 讨论(0)
  • 2020-12-13 06:51

    I had similar issue with glob module. I deleted glob = "*" from Pipfile and it worked fine after that.

    Error:

    bash-4.2# pipenv lock  --clear
    Locking [dev-packages] dependencies…
    ✔ Success! 
    Locking [packages] dependencies…
    ✘ Locking Failed! 
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
    [pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
    [pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
    [pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
    [pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
    [pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches glob
    [pipenv.exceptions.ResolutionFailure]:       No versions found
    [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: ERROR: Could not find a version that matches glob
    No versions found
    Was https://pypi.org/simple reachable?
    [pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
    [pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
    [pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
    [pipenv.exceptions.ResolutionFailure]:   File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
    [pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
    [pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches glob
    [pipenv.exceptions.ResolutionFailure]:       No versions found
    [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: ERROR: Could not find a version that matches glob
    No versions found
    Was https://pypi.org/simple reachable?
    
    0 讨论(0)
  • 2020-12-13 06:54

    vi Pipfile and remove the offending packages. Worked nicely for me.

    0 讨论(0)
提交回复
热议问题