Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

upgrade pip/setuptools and install wheel in venv? #17

Closed
anthrotype opened this issue May 24, 2018 · 11 comments
Closed

upgrade pip/setuptools and install wheel in venv? #17

anthrotype opened this issue May 24, 2018 · 11 comments

Comments

@anthrotype
Copy link

when using the regular tox (without tox-venv plugin), the created environments will have the latest versions of pip and setuptools, because the default behaviour of virtualenv is to reach out to the Internet to download the latest versions from PyPI, unless --no-download is passed (which tox doesn't seem to be doing). In addition, virtualenv always installs the wheel module as well as pip and setuptools.

However, when using the built-in python3's venv module, pip and setuptools gets installed using the ensurepip built-in module, which by design does not access the Internet. Also, wheel doesn't get automatically installed when doing ensurepip.

For consistency between the tox environments for python2.7 and those for python3+, it would be great if tox-venv plugin would do a python -m pip install --upgrade pip setuptools wheel after having created the new venv.

Thanks!

@rpkilby
Copy link
Member

rpkilby commented May 24, 2018

Yeah - this shouldn't be difficult to add. Possible ini setup...

[tox]
...

[venv]
upgrade = true  ; upgrades pip & setuptools
upgrade =  ; or upgrade pip & setuptools to the specified versions
    pip>=10
    setuptools>=36

That said, I would say 👎 to including wheel here. The only necessary dependencies for installing packages are pip and setuptools. If tests rely on wheel, they should depend on it explicitly.

@anthrotype
Copy link
Author

Thanks @rpkilby. The proposed config option looks good to me. And I'm fine with depending explicitly on wheel when needed.
I'm afraid I won't have time to work on a PR right now, but I'll keep an eye on it.

@AvdN
Copy link

AvdN commented Aug 7, 2018

I was going to ask if something like this could be added. The other thing I was going to look at is run something in the configuration (possible in my tox-globinterpreter install) before the normal install.
Since I gernate my tox.ini files on the fly, adding a pip upgrade line is not a big hassle (but neither is adding a [venv] section :-)

If that option upgrade=true is set though, it would be faster to create the venv with --without-pip and then use the pip belonging to the python installed to directly install the latest version of pip in the newly created virtual environment with something like:

 /opt/python/version/bin/pip --disable-pip-version-check --target .tox/pyXY pip

(Actually --target puts everything, including the executable pip under lib/pythonX.Y/site-packages) and ``--root and --prefix don't seem to do much. So you would need an --install-option (I should have known: https://stackoverflow.com/a/11017307/1307905 )

@AvdN
Copy link

AvdN commented Aug 7, 2018

FWIW: I solved this for me by writing a utility that downloads the latest wheels for pip and setuptools and updates the hardcoded numbers in lib/ensurepip/__init__.py
You only need only one file, which can be found as package on https://pypi.org/project/upgrade-ensurepip/

@jaraco
Copy link

jaraco commented Sep 19, 2018

#25 also addresses this issue.

@rpkilby
Copy link
Member

rpkilby commented Apr 18, 2019

@jaraco
Copy link

jaraco commented Apr 19, 2019

I don’t think so. The requires directive indicates which version of tox-venv should be used... or which version of setuptools must be present in the environment alongside tox. But it doesn’t designate anything about the target environments.

@rpkilby
Copy link
Member

rpkilby commented Apr 19, 2019

👌 Thanks

@helpr helpr bot added the pr-rejected label Sep 30, 2019
@jaraco
Copy link

jaraco commented Sep 30, 2019

It sounds like the solution is to use tox-pip-version with pip-version=pip. In other words:

[tox]
minversion = 3.2
requires =
    tox-pip-version

[testenv]
pip_version = pip

@jaraco
Copy link

jaraco commented Feb 15, 2020

This problem becomes more serious in light of #42. Now tox-venv is simply unviable in some environments where tox without it works. And the tox-pip-version recommendation is no help.

@jaraco
Copy link

jaraco commented May 1, 2020

tox-venv is being deprecated, so this issue no longer needs attention.

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.

5 participants