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

impossible to use install_command if you need newer pip #765

Closed
ssbarnea opened this issue Feb 14, 2018 · 7 comments
Closed

impossible to use install_command if you need newer pip #765

ssbarnea opened this issue Feb 14, 2018 · 7 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.

Comments

@ssbarnea
Copy link
Member

ssbarnea commented Feb 14, 2018

It seems that the current implementation of install_command introduces a conflict that seems impossible to resolve when system pip version is older, mainly because it is impossible to tell tox to upgrade pip before installing requirements.

Imagine that you have this command:

install_command = pip install -cupper-constraints.txt {opts} {packages}

This may fail if the pip version is older and does not support -c parameter but at the same time we cannot upgrade pip inside the virtualenv before running the command.

If I try to force upgrading pip by adding it to the top of dependencies, I still get the failure, because the -c param does not exist. If I remove the param, I loose the functionality needed for the rest of packages.

Somehow, this makes the entire install_command impossible to use. Do we have a workaround for this issue, one that does not require upgrade system pip which would be against tox principle of not having to touch the system.

Considering that doing the installation manually, using commands = works, this indicates a tox bug.

@BenjamenMeyer
Copy link

BenjamenMeyer commented Feb 14, 2018

  1. Question: Does a multi-line install command resolve this?
install_command = 
     pip install --upgrade pip
     pip install -cupper-constraints.txt {opts} {packages}
  1. One thing I've run into is system tox not being new enough, so I've ended up making a custom bash script (https://github.com/BenjamenMeyer/traveling-salesman/blob/master/bash/tox) that creates its own virtualenv within which it then executes a newer version of tox. That may also solve your use-case here - at least as a work around until a proper solution can be found.

Another solution (more specific to your description) might be to have a flag to auto-upgrade pip:

[testenv]
autoupgrade_pip = true

Which tox could then use to update pip automatically before doing anything else when creating the virtualenv.

@ssbarnea
Copy link
Member Author

I do find both ideas good. Maybe the autoupgrade pip one can be make a little bit more generic for upgrading all implicit packages, which I think is composed out of virtualenv, pip and setuptools.

If this can param can also be mentioned at main tox section, even better (at least for me).

@dchudz
Copy link

dchudz commented Mar 13, 2018

@ssbarnea I'm having a similar issue - can I ask what you ended up doing as a workaround? Just skip_install=True and putting all installations in the commands = section?

@gaborbernat gaborbernat added the feature:new something does not exist yet, but should label Mar 13, 2018
@gaborbernat
Copy link
Member

So I think this falls under new feature requirements, we should support a requires field which gets evaluated after virtual environment creation, similar to how https://www.python.org/dev/peps/pep-0517/ has it for build requires.

@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Mar 13, 2018
@gaborbernat
Copy link
Member

#791 reports how now we always have latest pip. Will close in favour of that request.

@ssbarnea
Copy link
Member Author

@gaborbernat I am using tox 3.7.0 (and virtualenv 15.0) and I am sure that it does not use latest pip. I still see pip reporting that version 9.0.1 is older than 19.0.3.

I am still looking for a reliable way to assure a minimal pip version before installing deps = ....

@gaborbernat
Copy link
Member

gaborbernat commented Mar 11, 2019

@ssbarnea #791 will allow such feature... for now the only way you can control version of pip is by controlling the version of virtualenv installed and then setting the VIRTUALENV_NO_DOWNLOAD env var. One could say https://tox.readthedocs.io/en/latest/config.html#conf-requires virtualenv >= 16.4.0, this would enforce the latest pip. For now this would need to be manually provided by the user, however, as I write this I'm also working on #998 which will automate this away.

apehex pushed a commit to apehex/cookiecutter-pypi that referenced this issue Sep 14, 2020
@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

4 participants