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

Allow system_site_packages=True in Virtualenv.create() #1973

Open
PhoenixHe-NV opened this issue Nov 3, 2022 · 5 comments
Open

Allow system_site_packages=True in Virtualenv.create() #1973

PhoenixHe-NV opened this issue Nov 3, 2022 · 5 comments

Comments

@PhoenixHe-NV
Copy link

Currently PEX could create virtualenv to populate bundled packages, and in PEX code it allows to create venv with "--system-site-packages", but there is no way to specify this parameter at runtime.

We want to run with venv and system-site-packages enabled, can we have an extra environment variable to specify this behavior?

@jsirois
Copy link
Member

jsirois commented Nov 3, 2022

Did you know you can do this?:

PEX_TOOLS=1 ./my.pex venv here/ --help

Or use the pex-tools console script available when you install the pex tool:

pex-tools ./my.pex --help
pex-tools ./my.pex venv --help

Does that satisfy your requirements?

@PhoenixHe-NV
Copy link
Author

@jsirois Thanks for your advice! It's a good idea to specify the option in pex-tools, but seems like it doesn't pass system-site-packages

https://github.com/pantsbuild/pex/blob/52c84031bc22781f59e6acba74be9c5736fb3598/pex/tools/commands/venv.py#L177-L183

@jsirois
Copy link
Member

jsirois commented Nov 4, 2022

Aha, right. So, if a pex-tools venv --system-site-packages option were added, would that work for you then? If so I'll mark this as a feature request and if you want to implement that feature I'm happy to review; otherwise it will go into the current backlog tracked in #1975.

@PhoenixHe-NV
Copy link
Author

@jsirois Adding a new option --system-site-packages would work for me. I don't have enough time to implement this feature, but I could modify pyenv.cfg after venv extracted. Anyway, please add this to backlog, thanks!

@PhoenixHe-NV
Copy link
Author

@jsirois Now I'm blocked without this feature. If I manually modify pyvenv.cfg to change to include-system-site-packages = true, but the “pip” is extracted without --system-site-packages, then if I packed "pip", in extracted venv's pip, it will have #!/tmp/pex_venv/bin/python3.8 -sE at the first line, which will let pip list skip user local site ($HOME/.local)

Maybe I'll try to make a PR on this issue...

This was referenced Nov 21, 2022
@jsirois jsirois mentioned this issue Nov 28, 2022
2 tasks
This was referenced Dec 8, 2022
@jsirois jsirois mentioned this issue Jan 9, 2023
2 tasks
@jsirois jsirois mentioned this issue Jan 18, 2023
3 tasks
This was referenced Feb 12, 2023
This was referenced Feb 25, 2023
This was referenced Mar 7, 2023
@jsirois jsirois mentioned this issue Mar 23, 2023
2 tasks
@jsirois jsirois mentioned this issue Mar 30, 2023
2 tasks
This was referenced Apr 17, 2023
@jsirois jsirois mentioned this issue May 1, 2023
2 tasks
@jsirois jsirois mentioned this issue May 4, 2023
1 task
@jsirois jsirois mentioned this issue May 13, 2023
2 tasks
@jsirois jsirois mentioned this issue Jul 1, 2023
3 tasks
This was referenced Jul 21, 2023
This was referenced Aug 3, 2023
@jsirois jsirois mentioned this issue Aug 12, 2023
1 task
This was referenced Aug 22, 2023
@jsirois jsirois mentioned this issue Sep 18, 2023
1 task
@jsirois jsirois mentioned this issue Sep 30, 2023
1 task
This was referenced Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants