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

Update pip to defined versions after creating a new venv [feature] #1971

Closed
wants to merge 2 commits into from
Closed

Update pip to defined versions after creating a new venv [feature] #1971

wants to merge 2 commits into from

Conversation

tsvikas
Copy link

@tsvikas tsvikas commented Feb 3, 2020

Until now, a new venv created with poetry would have an undefined pip version (for example, in my setup it's pip 18.1). This could be problematic, as older pip versions are not compatible with some packages (manylinux2010/2014 packages - for example, tensorflow 2), and might have security risks. On the other hand, future pip versions might introduce API changes that will prevent poetry from working.

This code forces new venvs to update their pip to a version from a defined range of versions. Updating pip happens just after the venv creation (and not each time before package installation). This will allow users to manually change it if the need arises.

Code is loosely based on #740

I know that the need for internet connectivity in venv creation might be an issue, but I was not sure how to tackle it, and I wanted to get feedback on this code first.

Closes:

closes #732 (partially - this PR does not install setuptools)
closes #1661
closes #1962
closes #1651

Pull Request Check List

  • Added tests for changed code.
    Tests were passing in my setup, but might need tweaking to pass with different setups (i.e. python 3.4)
  • Updated documentation for changed code.
    No relevant documentation found, but I did my best to add relevant comments.
    Should I update the changelog?

Tsvika added 2 commits February 3, 2020 18:46
Until now, a new venv created with poetry would have an undefined pip version.
This could be problematic, as older pip versions are not compatible with some packages (see issues list below), and might have security risks.
And on the other hand, future pip versions might introduce API changes that will prevent poetry from working.

This commit forces new venvs to update pip to a defined range of versions.
Updating pip just after venv creation (and not each time before package installation) will still allow users to manualy change it, if the need arise.

code is loosely based on #740

closes:
#732
#1661
#1962
#1651
in windows, run() forces shell=True, which understand the < and > in the requirements as cmd operators.
To prevent that, we encase the requirement in quotes, but this requires us to use shell=True in linux also.
@finswimmer finswimmer added kind/feature Feature requests/implementations area/venv Related to virtualenv management labels Feb 10, 2020
@maksbotan
Copy link
Contributor

Hi,

I've also run into this issue, when pip in the created venv was at 9.0 and failed to do some commands the expected way.

It would be nice if poetry would update pip in the venv to some sane version before installing packages.

@finswimmer
Copy link
Member

Thanks a lot for your contribution @tsvikas!

In the meantime this PR is superseded by #2666, this is why I will close yours.

@finswimmer finswimmer closed this Aug 4, 2020
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/venv Related to virtualenv management kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants