You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issue tracker and believe that this is not a duplicate.
Following #708, it seems that the addition of the NO_SITE_PACKAGES does a bit too much.
What I understood is that Python packages installed in the interpreter or user site-packages would not be found.
But in practice, it seems that behavior leaks even in other virtualenvs, breaking compatibility with pipx for example.
Steps to reproduce
% pipx install -f pdm==1.10.0Installing to existing venv 'pdm' installed package pdm 1.10.0, Python 3.9.7 These apps are now globally available - pdmdone! ✨ 🌟 ✨
% pdm run pdm Usage: pdm [OPTIONS] [COMMANDS] ...PDM - Python Development MasterCommands: {add,build,cache,completion,config,export,import,info,init,install,list,lock,plugin,remove,run,search,show,sync,update,use} add Add package(s) to pyproject.toml and install them build Build artifacts for distribution cache Control the caches of PDM completion Generate completion scripts for the given shell config Display the current configuration export Export the locked packages set to other formats import Import project metadata from other formats info Show the project information init Initialize a pyproject.toml for PDM install Install dependencies from lock file list List packages installed in the current working set lock Resolve and lock dependencies plugin Manage the PDM plugins remove Remove packages from pyproject.toml run Run commands or scripts with local packages loaded search Search for PyPI packages show Show the package information sync Synchronize the current working set with lock file update Update package(s) in pyproject.toml use Use the given python version or path as base interpreterOptional Arguments: -h, --help show this help message and exit -V, --version show the version and exit -v, --verbose -v for detailed output and -vv for more detailed -I, --ignore-python Ignore the Python path saved in the pdm.toml config --pep582 [SHELL] Print the command line to be eval'd by the shell
% pipx install -f pdm==1.10.1Installing to existing venv 'pdm' installed package pdm 1.10.1, Python 3.9.7 These apps are now globally available - pdmdone! ✨ 🌟 ✨
% pdm run pdm Traceback (most recent call last): File "/home/pawamoy/.local/bin/pdm", line 5, in <module> from pdm.core import mainModuleNotFoundError: No module named 'pdm'
The use of pdm here as the command is purely arbitrary. I get the same result with any tool installed through pipx, for example pdm run safety.
Actual behavior
When running a Python tool that is on the PATH, and that uses a virtualenv, a ModuleNotFoundError is raised.
Expected behavior
External Python tools (using completely separated virtualenvs) should not be impacted by this isolation. They are on the PATH after all.
You don't need pdm run if the executable is on the PATH. Maybe a flag will be added to pdm run but the default behavior is to load local packages only.
I don't need it, but it is applied anyway in the subcommands of a task runner for example.
# the task runner exec is in __pypackages__/*/bin, I need pdm run
pdm run TASKRUNNER COMMAND
...
# the task runner command runs pdm in a subprocess
requirements = ctx.run(["pdm", "export", "-f", "requirements", "--without-hashes"])
# but isolation is applied, so it ends up with a ModuleNotFoundError
Following #708, it seems that the addition of the
NO_SITE_PACKAGES
does a bit too much.What I understood is that Python packages installed in the interpreter or user site-packages would not be found.
But in practice, it seems that behavior leaks even in other virtualenvs, breaking compatibility with pipx for example.
Steps to reproduce
The use of
pdm
here as the command is purely arbitrary. I get the same result with any tool installed through pipx, for examplepdm run safety
.Actual behavior
When running a Python tool that is on the PATH, and that uses a virtualenv, a ModuleNotFoundError is raised.
Expected behavior
External Python tools (using completely separated virtualenvs) should not be impacted by this isolation. They are on the PATH after all.
Environment Information
The text was updated successfully, but these errors were encountered: