uv icon indicating copy to clipboard operation
uv copied to clipboard

uv venv --system-site-packages support

Open owenlamont opened this issue 1 year ago • 1 comments

I was wondering if uv venv could get support for the venv --system-site-packages option. We have virtual environments that use system installed packages for some of the more complex geospatial packages which we found causes less problems than pip installing those and I'd love to use uv venv if it also supported accessing/using system packages.

owenlamont avatar Feb 16 '24 12:02 owenlamont

This seems reasonable to me

zanieb avatar Feb 16 '24 14:02 zanieb

@owenlamont for a temporary fix, you can manually edit the pyvenv.cfg after creating the environment, e.g.:

$ uv venv uv-venv-test
Using Python 3.11.6 interpreter at /Users/samforeman/micromamba/envs/2023-11-11/bin/python3.11
Creating virtualenv at: uv-venv-test
Activate with: source uv-venv-test/bin/activate

Now, in the file: uv-venv-test/pyvenv.cfg change the following line:

~~include-system-site-packages = false~~

to

include-system-site-packages = true

Once complete, your pyvenv.cfg should look something like:

$ cat uv-venv-test/pyvenv.cfg
home = /Users/samforeman/micromamba/envs/2023-11-11/bin
implementation = CPython
version_info = 3.11
gourgeist = 0.0.4
include-system-site-packages = true
base-prefix = /Users/samforeman/micromamba/envs/2023-11-11
base-exec-prefix = /Users/samforeman/micromamba/envs/2023-11-11
base-executable = /Users/samforeman/micromamba/envs/2023-11-11/bin/python3.11

saforem2 avatar Feb 20 '24 21:02 saforem2