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

pip installed in virtualenv matches virtualenv installation python not python in virtualenv #1600

Closed
emonty opened this issue Feb 12, 2020 · 6 comments · Fixed by #1655
Closed

Comments

@emonty
Copy link

emonty commented Feb 12, 2020

This one's a little esoteric - but if you install virtualenv>20 with python2, then create a virtualenv with --python=python3 - the pip commands installed in the virtualenv are pip and pip2 rather than pip and pip3. Basically, the suffix is matching the python that the virtualenv is running with, not the python that the virtualenv is installing.

For example:

# pip2 install 'virtualenv==20.0.3'
# /usr/bin/virtualenv -p python3 blerg . # this is in a centos7 container, pip2 installs into /usr/bin
# ls blerg/bin/pip*
pip pip2 pip2.7
# rm -rf blerg
# pip2 install 'virtualenv<20'
# /usr/bin/virtualenv -p python3 blerg
# ls blerg/bin/pip*
pip pip3 pip3.6
@gaborbernat
Copy link
Contributor

We need to convince our script maker to use the target environments version, not the host pythons version at https://github.com/pypa/virtualenv/blob/master/src/virtualenv/seed/via_app_data/pip_install/base.py#L133-L140

@asottile
Copy link
Contributor

I believe distlib needs a feature to make this happen: https://bitbucket.org/pypa/distlib/issues/134/scriptmaker-ability-to-select-the-version

@gaborbernat
Copy link
Contributor

@asottile what happened with the upstream issue; seems to lead to 404 🤔

@gaborbernat
Copy link
Contributor

Anyways pushed a workaround now under #1655 until upstream allows doing this.

@gaborbernat
Copy link
Contributor

Reported the feature request again upstream under the link https://bitbucket.org/pypa/distlib/issues/134/allow-specifying-the-version-information

gaborbernat added a commit that referenced this issue Feb 22, 2020
Resolves #1600.

Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
@gaborbernat
Copy link
Contributor

Hello, a fix for this issue has been released via virtualenv 20.0.6; see https://pypi.org/project/virtualenv/20.0.6/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-6-2020-02-26) . Please give a try and report back if your issue has not been addressed; if not, please comment here, and we'll reopen the ticket. We want to apologize for the inconvenience this has caused you and say thanks for having patience while we resolve the unexpected bugs with this new major release.
thanks

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants