question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pipenv install behaves different if using >= instead of ==

See original GitHub issue

tl;dr pipenv compares version strings differently if install parameter has version selection operator >=, e.g. >=4.0b vs. ==4.0b.

Running pipenv install 'pyyaml>=4.2b1' within a pipenv virtual environment fails with message Could not find a version that matches pyyaml>=4.2b1.

`pipenv install 'pyyaml>=4.2b1'` output
PS> mkdir test8
PS> cd test8
PS> pipenv --version
pipenv, version 2018.11.26

PS> pipenv shell
Creating a virtualenv for this project…
Pipfile: C:\Users\user1\Projects\test8\Pipfile
Using c:\python\python37\python.exe (3.7.1) to create virtualenv…
[   =] Creating virtual environment...Already using interpreter c:\python\python37\python.exe
Using base prefix 'c:\\python\\python37'
New python executable in C:\Users\user1\.virtualenvs\test8-PXjge-vL\Scripts\python.exe
Installing setuptools, pip, wheel...
done.

Successfully created virtual environment!
Virtualenv location: C:\Users\user1\.virtualenvs\test8-PXjge-vL
Creating a Pipfile for this project…
Launching subshell in virtual environment…
Windows Powershell 5.1.17763.316
Copyright (C) Microsoft Corporation. All rights reserved.

PS> pipenv install 'pyyaml>=4.2b1'
Installing pyyaml>=4.2b1…
Adding pyyaml to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "c:\python\python37\lib\site-packages\pipenv\utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "c:\python\python37\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "c:\python\python37\lib\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 pyyaml>=4.2b1
[pipenv.exceptions.ResolutionFailure]:       Tried: 3.10, 3.10, 3.11, 3.11, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 4.2b1, 4.2b2, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 5.1b1, 5.1b3
[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 pyyaml>=4.2b1
Tried: 3.10, 3.10, 3.11, 3.11, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13
Skipped pre-versions: 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 4.2b1, 4.2b2, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 5.1b1, 5.1b3
There are incompatible versions in the resolved dependencies.
[pipenv.exceptions.ResolutionFailure]:   File "c:\python\python37\lib\site-packages\pipenv\utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "c:\python\python37\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "c:\python\python37\lib\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 pyyaml>=4.2b1
[pipenv.exceptions.ResolutionFailure]:       Tried: 3.10, 3.10, 3.11, 3.11, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 4.2b1, 4.2b2, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 5.1b1, 5.1b3
[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 pyyaml>=4.2b1
Tried: 3.10, 3.10, 3.11, 3.11, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.12, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13, 3.13
Skipped pre-versions: 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13b1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 3.13rc1, 4.2b1, 4.2b2, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 4.2b4, 5.1b1, 5.1b3
There are incompatible versions in the resolved dependencies.


Yet pipenv install 'pyyaml==4.2b1' succeeds

`pipenv install 'pyyaml==4.2b1' output
PS> pipenv install 'pyyaml==4.2b1'
Installing pyyaml==4.2b1…
Adding pyyaml to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (bf53d5)!
Installing dependencies from Pipfile.lock (bf53d5)…
  ================================ 1/1 - 00:00:02

Problems I see:

  • pipenv appears to behave differently for version selection operator >=
  • pipenv does not log the version it parsed. I don’t know if pipenv parsed the passed version value as 4.2b1 or =4.2b1 or >=4.2b1 or something else.

Similar to Issue #3568 (and others).

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: 'c:\\python\\python37\\lib\\site-packages\\pipenv'

Python location: 'c:\\python\\python37\\python.exe'

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.1',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'python_full_version': '3.7.1',
 'python_version': '3.7',
 'sys_platform': 'win32'}

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • VIRTUAL_ENV: C:\Users\user1\.virtualenvs\test8-PXjge-vL

Contents of Pipfile (‘C:\Users\user1\OneDrive\Projects\test8\Pipfile’):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
pyyaml = "==4.2b1"

[requires]
python_version = "3.7"

Contents of Pipfile.lock (‘C:\Users\user1\OneDrive\Projects\test8\Pipfile.lock’):

{
    "_meta": {
        "hash": {
            "sha256": "d040cd80066475107689295402b3ff9aef71f7cdf6f1b795ab0f19a26dbf53d5"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "pyyaml": {
            "hashes": [
                "sha256:2c6b1522d651e6264cec4e3d59eda497aec576ce4f39d389ed77dc6c3748c598",
                "sha256:ef3a0d5a5e950747f4a39ed7b204e036b37f9bddc7551c1a813b8727515a832e"
            ],
            "index": "pypi",
            "version": "==4.2b1"
        }
    },
    "develop": {}
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frostmingcommented, Mar 13, 2019

@jtmoon79 It is described in pipenv install --help, pipenv --help is for showing available commands and global options.

0reactions
jtmoon79commented, Mar 12, 2019

I should add, --pre is not described in the pipenv --help. It is alluded to in one --help example but not adequately articulated.

Using pipenv, version 2018.11.26.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv install inside virtual environment - Stack Overflow
I do understand that pipenv installs "inside" the venv. However, if you run pipenv inside the venv, it will create another venv within...
Read more >
Pipenv: A Guide to the New Python Packaging Tool
Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and the good...
Read more >
pipenv Documentation - Read the Docs
The recommended way to install pipenv on most platforms is to install from pypi using pip: $ pip install --user pipenv. Or, if...
Read more >
pipenv Documentation
Pipenv is a dependency manager for Python projects. If you're familiar with Node.js's npm or Ruby's bundler, it is similar in spirit to...
Read more >
Pipenv: Python Packagement for Champions!
Dev-only dependencies are a hassle to separate. Uninstalling packages will not remove sub-packages. Dependencies with version ranges instead of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found