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

Use creator venv when creating virtual environments #5376

Merged
merged 2 commits into from
Sep 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ def do_create_virtualenv(project, python=None, site_packages=None, pypi_mirror=N
Path(sys.executable).absolute().as_posix(),
"-m",
"virtualenv",
"--creator=venv",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify this to: -m venv I hope we are not using any specific features of virtualenv which aren't found in venv.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that Ubuntu does not ship venv as part of the system python so this might not solve the issue...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change did solve the issue for my ubuntu 22.04 -- I am not sure if that -m venv is equivalent to this, do you know?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The built in module venv is a trimmed down version of virtualenv: https://virtualenv.pypa.io/en/latest/.
We can't use this approach immediately anyway because it only supports one python version.

To use this approach, we will have to detect the python version by ourselves. That's because you can only do:

python3.X -m venv ...

Instead of:

python -m virtualenv --python ....

f"--prompt={project.name}",
f"--python={python}",
project.get_location_for_virtualenv(),
Expand Down