Skip to content
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

No module named 'pipenv.vendor.pipdeptree._detect_env' #6305

Closed
bertek41 opened this issue Nov 1, 2024 · 4 comments · Fixed by #6307
Closed

No module named 'pipenv.vendor.pipdeptree._detect_env' #6305

bertek41 opened this issue Nov 1, 2024 · 4 comments · Fixed by #6307

Comments

@bertek41
Copy link

bertek41 commented Nov 1, 2024

Issue description

Latest release has an error:

Successfully created virtual environment!
Virtualenv location: /github/home/.local/share/virtualenvs/workspace-0SCQBxY3
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (8d[26](https://github.com/*****#step:6:27)6f)...
All dependencies are now up-to-date!
Error running command: $ 
/github/home/.local/share/virtualenvs/workspace-0SCQBxY3/bin/python 
/usr/local/lib/python3.11/site-packages/pipenv/vendor/pipdeptree -l --reverse 
--json-tree
STDERR: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File 
"/usr/local/lib/python3.11/site-packages/pipenv/vendor/pipdeptree/__main__.py", 
line 16, in <module>
    from pipenv.vendor.pipdeptree._detect_env import detect_active_interpreter
ModuleNotFoundError: No module named 'pipenv.vendor.pipdeptree._detect_env'

Steps to replicate

Latest release "pipenv-2024.3.1" has this bug. I don't have this bug in "pipenv-2024.3.0"

@sanders41
Copy link
Contributor

sanders41 commented Nov 1, 2024

I am seeing a similar error, but with a slightly different error, pipenv.vendor.pipdeptree._cli instead of pipenv.vendor.pipdeptree._detect_env. I'm assuming something changed in vendored packages and these are related.

STDERR: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/paul/.local/share/uv/tools/pipenv/lib/python3.13/site-packages/pipenv/vendor/pipdeptree/__main__.py", line 15, in <module>
    from pipenv.vendor.pipdeptree._cli import get_options
ModuleNotFoundError: No module named 'pipenv.vendor.pipdeptree._cli'

Possibly related to #6275?

@matteius
Copy link
Member

matteius commented Nov 1, 2024

pipdeptree vendowing was completed a few releases ago; I suspect these str conversions of the path are maybe involved but I don't know why it would be, so maybe something else 🤔 https://github.com/pypa/pipenv/pull/6300/files#diff-00868b196644e73191bf37befbde5a1aedb22dbc0b5920aa33eba63d6f119d66R112

@sanders41
Copy link
Contributor

I did a bisect and 6f2929b is where the error started. Unfortunately it was a hacky bisect and I haven't been able to come up with a good minimal reproducer yet.

I'm not sure if it helps, but this lock file causes the error https://github.com/meilisearch/meilisearch-python/blob/9b2c99a9ad542907425bce946e60e6dba9be5edc/Pipfile.lock. I haven't yet come up with another lock file that reproduces it.

@sanders41
Copy link
Contributor

sanders41 commented Nov 1, 2024

I think I have figured out what the issue is, but I'm not sure the best way to go about fixing it. Several paths are added to sys.path in pipdeptree/__main__.py so that the imports can be found, but the command is run with run_command which uses a subprocess. Because it is run in a new process it doesn't have the appended paths.

Edit: on further testing this doesn't seem to be the issue. It looks like the paths are getting added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants