Skip to content

"UndefinedEnvironmentName: 'extra' does not exist in evaluation environment" when defining extra dependencies #3953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
muelli opened this issue Sep 6, 2016 · 3 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@muelli
Copy link

muelli commented Sep 6, 2016

  • Pip version:
    8.1.2
  • Python version:
    2.7
  • Operating System:
    Ubuntu 16.04.
$ python -c "import setuptools; print setuptools.__version__"
20.7.0
$ cat requirements.txt 
pytest; extra == "test"
$ pip install --user -r requirements.txt 
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 305, in run
    wheel_cache
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 291, in populate_requirement_set
    requirement_set.add_requirement(req)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 224, in add_requirement
    if not install_req.match_markers():
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 823, in match_markers
    return Marker(self.markers).evaluate()
  File "/usr/share/python-wheels/packaging-16.6-py2.py3-none-any.whl/packaging/markers.py", line 278, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/usr/share/python-wheels/packaging-16.6-py2.py3-none-any.whl/packaging/markers.py", line 203, in _evaluate_markers
    lhs_value = _get_env(environment, lhs.value)
  File "/usr/share/python-wheels/packaging-16.6-py2.py3-none-any.whl/packaging/markers.py", line 185, in _get_env
    "{0!r} does not exist in evaluation environment.".format(name)
UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.

but this issue also happens with setuptools 26.1.1.

muelli added a commit to muelli/geysigning that referenced this issue Sep 6, 2016
I've never really understood when to use setup.py's facilities
or requirements. pip install -r requirements.txt seems to be
broken.  pypa/pip#3953

Now we're using setuptool's extras_requires as per
https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies

I do realise, though, that in this particular case
tests_require would be more appropriate.
http://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords
@ionelmc
Copy link
Contributor

ionelmc commented Sep 6, 2016

afaik pytest doesn't have a "test" extra. What did you intend to do there?

@dholth
Copy link
Member

dholth commented Sep 6, 2016

pytest; extra == "test" is the syntax that would appear in *.dist-info/METADATA if pip install yourpackage[test] should install pytest. It is probably not useful in requirements.txt.

@dstufft
Copy link
Member

dstufft commented Sep 7, 2016

We do not support extra == "whatever" syntax inside of a requirements.txt file.

@dstufft dstufft closed this as completed Sep 7, 2016
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

4 participants