-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Checklist
- I added a descriptive title
- I searched open requests and couldn't find a duplicate
What is the idea?
I am sorry to create a new issue for an old feature request, but it appears that previous issues requesting the same feature have been closed without resolution:
- Missing --no-site-packages option #394
- conda incompatible with local installations? #448
- make python user site-packages isolation in .local directory configurable #7707
- Isolating conda environments from ~/.local #7173
The core problem is that the search path Python uses for packages is configurable, but conda does not leverage that to remove search paths that are outside the conda environment. Many users find the resulting behavior unintuitive, and it is different from the default behavior of Python's venv library for virtual environment creation. So this feature request has two parts
- Environment creation needs an argument (default or not, I don't care) analagous to
--system-site-packages
. - Do it without using PYTHONNOUSERSITE environment variable.
The second part refers to current workarounds including the conda-ecosystem-user-package-isolation package or setting PYTHONNOUSERSITE
manually. Here is a case where this workaround is not useful.
A command line tool installed outside a given conda environment using pip install --user
, goes in ~/.local/bin/
and includes as its first line #!/path/to/a/python
. THAT Python is outside the conda environment, but if PYTHONNOUSERSITE
is active for the conda environment, site packages are disabled for ALL Python interpreters. This breaks the command line tool when invoked inside the conda environment.
Although conda does not create a virtual environment (as far as I understand ... and I may not), a pyvenv.cfg
file is checked by the site
module regardless. So, conda can do what venv does and create a pyvenv.cfg
file with the line include-system-site-packages = false
. I don't know what other repercussions that has involving sys.prefix
, but so far so good when I do it manually. Needs expert input.
Why is this needed?
No response
What should happen?
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status