Opened 3 years ago

Closed 3 years ago

#63383 closed defect (fixed)

pipenv sourcing from its own virtualenvs

Reported by: dgilman (David Gilman) Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: pipenv

Description

After recently updating to the latest pipenv 2021.5.29 I am unable to use pipenv on the command line. It appears to be sourcing packages out of the virtualenv maintained by pipenv, which lacks the backports.entry_points_selectable package and can't be launched.

This is with a fresh virtualenv (after pipenv --rm; pipenv sync):

07:56.user@system:~/src/deathstorm master$ pipenv shell
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 568, in _build_master
    ws.require(__requires__)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (backports.entry-points-selectable 0.0.0 (/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages), Requirement.parse('backports.entry_points_selectable>=1.0.4'), {'virtualenv'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/local/bin/pipenv", line 33, in <module>
    sys.exit(load_entry_point('pipenv==2021.5.29', 'console_scripts', 'pipenv')())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 781, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 700, in make_context
    self.parse_args(ctx, args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 1212, in parse_args
    rest = Command.parse_args(self, ctx, args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 1044, in parse_args
    parser = self.make_parser(ctx)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 965, in make_parser
    for param in self.get_params(ctx):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 912, in get_params
    help_option = self.get_help_option(ctx)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/cli/options.py", line 27, in get_help_option
    from ..core import format_help
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/core.py", line 33, in <module>
    from .project import Project
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/project.py", line 24, in <module>
    from .environment import Environment
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pipenv/environment.py", line 16, in <module>
    import pkg_resources
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module>
    def _initialize_master_working_set():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
    f(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 583, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'backports.entry_points_selectable>=1.0.4' distribution was not found and is required by virtualenv

However, to get it to work, I can explicitly use the MacPorts system installation:

07:55.user@system:~/src/deathstorm master$ /opt/local/bin/python3.9 -m pipenv --rm
Removing virtualenv (/Users/user/.local/share/virtualenvs/deathstorm-iA7v7lV-)...
07:55.user@system:~/src/deathstorm master$ /opt/local/bin/python3.9 -m pipenv sync
Creating a virtualenv for this project...
Pipfile: /Users/user/src/deathstorm/Pipfile
Using /opt/local/bin/python3.9 (3.9.6) to create virtualenv...
⠏ Creating virtual environment...created virtual environment CPython3.9.6.final.0-64 in 592ms
  creator CPython3Posix(dest=/Users/user/.local/share/virtualenvs/deathstorm-iA7v7lV-, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/user/Library/Application Support/virtualenv)
    added seed packages: pip==21.2.3, setuptools==57.4.0, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /Users/user/.local/share/virtualenvs/deathstorm-iA7v7lV-
Installing dependencies from Pipfile.lock (35060c)...
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 38/38 — 00:00:14
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
All dependencies are now up-to-date!
07:56.user@system:~/src/deathstorm master$ /opt/local/bin/python3.9 -m pipenv shell
Launching subshell in virtual environment...
 . /Users/user/.local/share/virtualenvs/deathstorm-iA7v7lV-/bin/activate
07:56.user@system:~/src/deathstorm master$  . /Users/user/.local/share/virtualenvs/deathstorm-iA7v7lV-/bin/activate

Change History (1)

comment:1 Changed 3 years ago by reneeotten (Renee Otten)

Owner: set to reneeotten
Resolution: fixed
Status: newclosed

In eb0d5716526c6c33dcf89f50d387a1ccdcfd9a70/macports-ports (master):

py-backports.entry-points-selectable: add missing build dependencies

Fixes: #63383

Note: See TracTickets for help on using tickets.