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.

UndefinedEnvironmentName exception in pip check

See original GitHub issue

Environment

  • pip version: 19.1.1
  • Python version: 3.6.7
  • OS: Ubuntu 18.04

Description

I install cvxpy package which has in its setup.py extras_require like:

    extras_require={
        'glpk': [
            (
                'cvxopt >= 1.2.0; sys_platform == "darwin" or '
                'sys_platform == "linux" or os_name == "nt" and '
                'python_version >= "3.5"'
            ),
        ],
    },

When I run pip3 check after installing this package, I get:

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 179, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/check.py", line 20, in run
    missing, conflicting = check_package_set(package_set)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/check.py", line 84, in check_package_set
    missed = req.marker.evaluate()
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 296, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 221, in _evaluate_markers
    lhs_value = _get_env(environment, lhs.value)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 203, in _get_env
    "{0!r} does not exist in evaluation environment.".format(name)
pip._vendor.packaging.markers.UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.

Expected behavior

Expected behavior would be that pip3 fails or succeeds normally, not to raise an unexpected exception.

How to Reproduce

  • pip3 install --upgrade pip
  • python3 --version
  • pip3 install cvxpy==1.0.22
  • pip3 check

Output

root@559ac0fa89f4:/# pip3 install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.4MB 5.9MB/s 
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-19.1.1
root@559ac0fa89f4:/# python3 --version
Python 3.6.7
root@559ac0fa89f4:/# pip3 install cvxpy
Collecting cvxpy
  Downloading https://files.pythonhosted.org/packages/2d/e0/7c6e1276b23bf1547a158ae3bdf99071550e3e7e18c59ffe8a8be0a88b91/cvxpy-1.0.22.tar.gz (913kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 921kB 2.2MB/s 
Collecting osqp>=0.4.1 (from cvxpy)
  Downloading https://files.pythonhosted.org/packages/c0/01/8becb29b0d38e0c40eab9e3d54aa8138fa62a010d519caf65e9210021bd3/osqp-0.5.0-cp36-cp36m-manylinux1_x86_64.whl (147kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 153kB 11.2MB/s 
Collecting ecos>=2 (from cvxpy)
  Downloading https://files.pythonhosted.org/packages/55/ed/d131ff51f3a8f73420eb1191345eb49f269f23cadef515172e356018cde3/ecos-2.0.7.post1-cp36-cp36m-manylinux1_x86_64.whl (147kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 153kB 9.8MB/s 
Collecting scs>=1.1.3 (from cvxpy)
  Downloading https://files.pythonhosted.org/packages/07/a7/0b19c8f9476a4762d296c6c5fa860f2fe580a4f579fa53aaa8515f4ca217/scs-2.1.0.tar.gz (154kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 163kB 16.9MB/s 
Collecting multiprocess (from cvxpy)
  Downloading https://files.pythonhosted.org/packages/31/60/6d74caa02b54ca43092e745640c7d98f367f07160441682a01602ce00bc5/multiprocess-0.70.7.tar.gz (1.4MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.4MB 14.4MB/s 
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from cvxpy) (1.11.0)
Requirement already satisfied: numpy>=1.15 in /usr/local/lib/python3.6/dist-packages (from cvxpy) (1.15.4)
Requirement already satisfied: scipy>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from cvxpy) (1.2.1)
Collecting future (from osqp>=0.4.1->cvxpy)
  Downloading https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz (829kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 829kB 11.9MB/s 
Collecting dill>=0.2.9 (from multiprocess->cvxpy)
  Downloading https://files.pythonhosted.org/packages/fe/42/bfe2e0857bc284cbe6a011d93f2a9ad58a22cb894461b199ae72cfef0f29/dill-0.2.9.tar.gz (150kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 153kB 12.7MB/s 
Building wheels for collected packages: cvxpy, scs, multiprocess, future, dill
  Building wheel for cvxpy (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/4c/23/fd/e3a1dbad553bc3cd540469a04c45806fe7fd4933bf6853f7c3
  Building wheel for scs (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/94/e2/a6/64db723051c54017c248ea5a26e7f1459c0242d735a496dd55
  Building wheel for multiprocess (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/3a/ed/51/77c833462c3e757ce50c4b2b68bdf53f5d1745542fe567d740
  Building wheel for future (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/0c/61/d2/d6b7317325828fbb39ee6ad559dbe4664d0896da4721bf379e
  Building wheel for dill (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/5b/d7/0f/e58eae695403de585269f4e4a94e0cd6ca60ec0c202936fa4a
Successfully built cvxpy scs multiprocess future dill
ERROR: Error checking for conflicts.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 524, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/check.py", line 118, in check_install_conflicts
    package_set, should_ignore=lambda name: name not in whitelist
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/check.py", line 84, in check_package_set
    missed = req.marker.evaluate()
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 296, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 221, in _evaluate_markers
    lhs_value = _get_env(environment, lhs.value)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 203, in _get_env
    "{0!r} does not exist in evaluation environment.".format(name)
pip._vendor.packaging.markers.UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.
Installing collected packages: future, osqp, ecos, scs, dill, multiprocess, cvxpy
Successfully installed cvxpy-1.0.22 dill-0.2.9 ecos-2.0.7.post1 future-0.17.1 multiprocess-0.70.7 osqp-0.5.0 scs-2.1.0
root@559ac0fa89f4:/# pip3 check
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 178, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/check.py", line 20, in run
    missing, conflicting = check_package_set(package_set)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/check.py", line 84, in check_package_set
    missed = req.marker.evaluate()
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 296, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 221, in _evaluate_markers
    lhs_value = _get_env(environment, lhs.value)
  File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/packaging/markers.py", line 203, in _get_env
    "{0!r} does not exist in evaluation environment.".format(name)
pip._vendor.packaging.markers.UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
pradyunsgcommented, Jul 22, 2019

@chrahunt FYI there’s a needs repro state label. πŸ™ƒ

0reactions
pradyunsgcommented, Apr 29, 2022

Closing since this is no longer an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building .pex files β€” pex 2.1.119 documentation
If a python_full_version environment marker is encountered during a resolve, an UndefinedEnvironmentName exception will be raised. To remedy this, eitherΒ ...
Read more >
`pip install` Gives Error on Some Packages - Stack Overflow
The real error in your case is: ImportError: cannot import name 'msvccompiler' from 'distutils'. It occured because setuptools has brokenΒ ...
Read more >
Markers - Packaging
UndefinedEnvironmentName : If the marker accesses a value that isn't present inside of the environment dictionary. exception packaging.markers.InvalidMarker#.
Read more >
Adding a default extra_require environment - Packaging
If you look at how pip currently handles package resolution, ... don't match your environment ERROR: Error while checking for conflicts.
Read more >
pipreqs - PyPI
Pip requirements.txt generator based on imports in project. ... Fix exception when 'import' is used inside package name #17. Add more testsΒ ...
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