pipenv: Markers now override unconditional dependencies resulting in a broken environment

This is a carryover from a discussion on https://github.com/pypa/pipenv/issues/1659 and the simplest way I could find to replicate this behavior.

With this Pipfile on macOS and pipenv 11.8.0:

[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[requires]

python_version = "3.6"

[packages]

arrow = "*"
coverage-space = "*"
faker = "*"
fire = "*"
freezegun = "*"
inflection = "*"
jupyter = "*"
pillow = "~=4.3"
pycodestyle = "~=2.3.1"
pylint = "~=1.7.5"
pytest = "~= 3.3"
pytest-cov = "*"
pytest-describe = "*"
pytest-expecter = "~= 1.1"
pytest-html = "*"
pytest-json-report = "~= 0.6"
pytest-mock = "*"
pytest-ordering = "*"
pytest-random = "*"
splinter = "*"
tldextract = "*"
watchdog = "*"
$ pipenv install

Creating a virtualenv for this project…
Using /Users/Browning/.pyenv/versions/3.6.3/bin/python3.6m (3.6.3) to create virtualenv…
...
Installing dependencies from Pipfile.lock (1ba60a)…
Ignoring colorama: markers 'sys_platform == "win32"' don't match your environment
Ignoring funcsigs: markers 'python_version < "3.0"' don't match your environment
  🐍   β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰ 88/88 β€” 00:00:26
To activate this project's virtualenv, run the following:
 $ pipenv shell

which results in a broken environment:

$ pipenv run coverage.space
Traceback (most recent call last):
  File "/Users/Browning/.local/share/virtualenvs/colorama-demo-Q5bNGJGk/bin/coverage.space", line 7, in <module>
    from coveragespace.cli import main
  File "/Users/Browning/.local/share/virtualenvs/colorama-demo-Q5bNGJGk/lib/python3.6/site-packages/coveragespace/cli.py", line 24, in <module>
    import colorama
ModuleNotFoundError: No module named 'colorama'

despite coverage-space directly requiring it:

$ pipenv graph --reverse
...
colorama==0.3.7
  - coverage-space==1.0 [requires: colorama~=0.3]
...

So it seems that one of the other packages only requires colorama on Windows and their markers are overriding the fact that another package depends on colorama unconditionally.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (26 by maintainers)

Commits related to this issue

Most upvoted comments

I can confirm this is fixed. Adding a couple of tests for it.

@techalchemy I am not able to reproduce this issue with 29a1a0b537f76586e543ea4d43b469e4ebf68174 on master.

So it seems like an β€œempty” markers needs to take precedence over markers.

add:

colorama = {version = "*", sys_platform="!='fake'"}

to your pipfile