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 specifying pip version #791

Closed
OrangeDog opened this issue Apr 18, 2018 · 26 comments
Closed

Allow specifying pip version #791

OrangeDog opened this issue Apr 18, 2018 · 26 comments
Labels
feature:new something does not exist yet, but should help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Milestone

Comments

@OrangeDog
Copy link

Currently it appears tox always installs the latest pip when (re)creating virtualenvs.
However sometimes (like today) the latest version doesn't work, or you haven't yet accounted for breaking changes.

Tox should have a way to control the version of pip.
Perhaps a pip_version config property, or allowing install_command to be multiple lines.

@gaborbernat gaborbernat added the feature:new something does not exist yet, but should label Apr 18, 2018
@asottile
Copy link
Contributor

asottile commented May 2, 2018

The latest behaviour here is due to virtualenv's downloading behaviour. If you want a more "consistent" version, I might suggest using tox-virtualenv-no-download#wait-why.

Related: #448

@gaborbernat gaborbernat added this to the 3.5 milestone Sep 18, 2018
@gaborbernat gaborbernat modified the milestones: 3.5, 3.6 Oct 8, 2018
@gaborbernat gaborbernat modified the milestones: 3.6, 3.7 Dec 16, 2018
@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label May 3, 2019
@gpotter2
Copy link

gpotter2 commented May 13, 2019

The latest behaviour here is due to virtualenv's downloading behaviour.

Is that still accurate ? Since today (new release?!), some of our AppVeyor builds (Python 2.7 builds) fail with an outdated pip version.

The issue is explicit:

[...]
  File "C:\projects\scapy\.tox\py27-windows\lib\site-packages\pip\_vendor\_markerlib\markers.py", line 113, in marker_fn
    return eval(compiled_marker, environment)
  File "<environment marker>", line 1, in <module>
  File "<environment marker>", line 1, in <module>
NameError: name 'platform_system' is not defined
You are using pip version 8.1.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

=================================== log end ===================================
ERROR: could not install deps [mock, setuptools>=18.5, cryptography, coverage, python-can]; v = InvocationError(u"'C:\\projects\\scapy\\.tox\\py27-windows\\Scripts\\python.EXE' -m pip install mock 'setuptools>=18.5' cryptography coverage python-can", 2)

I bumped into #765 then here :/

@gaborbernat
Copy link
Member

soon you can override the default version into pip, in the meantime please upgrade virtualenv alongside tox to get later defaults.👌

@gaborbernat
Copy link
Member

And yes with the latest version we no longer download latest pip.

@gaborbernat
Copy link
Member

When installing tox use the force reinstall flag to get latest virtualenv 😀

@gpotter2
Copy link

gpotter2 commented May 13, 2019

Thanks for this light-speed answer 😄

Does tox uses the pip version of the virtualenv ?
I'd rather only update pip

@gaborbernat
Copy link
Member

tox creates virtual environments that have their seed packages (pip, setuptools, wheel) with the version bundled within the virtualenv installed alongside it. you can of course use the deps then to upgrade to install another version. Or just upgrade virtualenv to have newer bundles.

nicoddemus added a commit to hroncok/pluggy that referenced this issue May 14, 2019
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 14, 2019
This attempts to fix the recent failures on Windows, as
suggested by tox-dev/tox#791
@jayvdb
Copy link

jayvdb commented Jun 11, 2019

There is https://github.com/pglass/tox-pip-version which does what this issue requests, I believe

GitHub
A tox plugin to select your pip version. Contribute to pglass/tox-pip-version development by creating an account on GitHub.

@pglass
Copy link

pglass commented Jun 11, 2019

you can of course use the deps then to upgrade to install another version

@gaborbernat This doesn't actually work in my experience. It will install a version of pip, yes, but tox will not actually use that new version of pip to install the rest of the dependencies.

The reason is because tox runs one pip command to install everything, like python -m pip install pip==19.1 requests (see example below). It won't start using pip version 19.1 until the next pip command is run.

[testenv]
deps =
    pip==19.1
    requests

Some other things I've tried:

  • Trying to change the install command, like install_command = pip install -U 'pip==18.1' {opts} {packages} has the same issue.
  • Using tox-run-before plugin, but this runs commands prior to the creation of the tox virtualenv (so it affects the currently active non-tox venv or else your system-wide installation, which is yucky), which brings me to the next point...

It is true that if you install a specific version of virtualenv prior to running tox, you can change the effective version of pip that tox uses to install packages. But, this still falls short in some ways:

  • This is not a solution for users of tox-venv, which uses python -m venv instead of the virtualenv package
  • It's not obvious which version of the virtualenv package comes with a particular version of pip (poor user experience)
  • Releases of the virtualenv package lag behind releases of pip (from a day to up to a week), so this isn't a viable solution in the "critical" period when a new release of pip breaks you

Hence, I did make a plugin for this (see previous comment), but it would be much nicer for this to be a native feature.

@gaborbernat
Copy link
Member

This will be fixed on the virtualenv side, I'm actively working on pypa/virtualenv#1366, I hope to have something by the end of the month.

uellue added a commit to uellue/LiberTEM that referenced this issue Jul 1, 2019
The re-install hopefully upgrades versions
tox-dev/tox#791
sk1p pushed a commit to LiberTEM/LiberTEM that referenced this issue Jul 2, 2019
The re-install hopefully upgrades versions
tox-dev/tox#791
@ssbarnea
Copy link
Member

ssbarnea commented Aug 6, 2019

Any update on that? I am looking for a workaround that can be used today, without waiting for a newer version of virtualenv.

@asottile
Copy link
Contributor

asottile commented Aug 6, 2019

@ssbarnea do you want "latest" -- you can re-enable virtualenv's downloading by setting the testenv download option:

[testenv]
download = true

@gaborbernat
Copy link
Member

No direct progress on this. Made some progress on the tox rewrite that will allow me to test the virtualenv rewrite... Coming along but this is a major effort (fixing a lot of hard issues while at it - e.g. lazy configuration load), so probably will last into September.

@The-Compiler
Copy link
Member

FWIW I'm using tox-venv because I've had some trouble with virtualenv in the past. This means I get whatever pip which ships with Python's ensurepip (as of Python 3.8.1, that's pip 19.2.3). However, I needed to install manylinux2014 wheels, which requires pip 19.3...

Installing tox-pip-version and setting pip_version = pip in [testenv] to get the latest pip worked beautifully - thanks @pglass! 🎉

@gaborbernat
Copy link
Member

tox-venv will become obsolete once pypa/virtualenv#1481 lands, and that will also solve this issue on virtualenv side 👍

@The-Compiler
Copy link
Member

I've been hearing about virtualenv rewrites for the past five years or so, so I wonder how this one turns out - good luck! 🤞

@gaborbernat
Copy link
Member

gaborbernat commented Jan 6, 2020

This one is very close to ship-able, 😊 so will actually happen, the latest end of February! I'm fully committed now to deliver it.

@Kentzo
Copy link

Kentzo commented Feb 11, 2020

Updating virtualenv that is installed alongside tox may not be an option since it may not support target python.

E.g. my host Python is 3.7 and my target Python is 2.6 / 3.4. Therefore I can install the most recent tox, but I cannot install the most recent virtualenv with most recent virtualenv dependencies.

@gaborbernat
Copy link
Member

Hello @Kentzo sadly we no longer support Python2.6, even at the target level. Python3.4 should still work.

@Kentzo
Copy link

Kentzo commented Feb 11, 2020

I just hope that this issue will not resurface in the future. tox's dependency on virtualenv_support is a major PITA.

@gaborbernat
Copy link
Member

Not sure what alternatives you're proposing here 🤷‍♂

@Kentzo
Copy link

Kentzo commented Feb 11, 2020

Ability to update pip / setuptools / etc inside bootstrapped virtualenv before installing any of the deps. Perhaps an ability to execute arbitrary shell code.

@gaborbernat
Copy link
Member

Definitely no to arbitrary shellcode; ability to do those via virtualenv will be provided; to be fair it already is via the --download flag of virtualenv.

@gaborbernat
Copy link
Member

gaborbernat commented Apr 19, 2020

This should be now possible by setting VIRTUALENV_PIP=19.0.0 with virtualenv 20.

@rouge8
Copy link

rouge8 commented Apr 19, 2020

This should be now possible by setting VIRTUALENV_PIP=19.0.0 with virtualenv 20.

@gaborbernat is there a way to tell tox what version of virtualenv to use? Or do we have to make sure people are running virtualenv 20+ another way?

@gaborbernat
Copy link
Member

You can use the requires key in the configuration.https://tox.readthedocs.io/en/latest/config.html#conf-requires

@tox-dev tox-dev 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.
Labels
feature:new something does not exist yet, but should help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

10 participants