How to update setuptools on tox during travis build

build, python, setuptools, tox, travis-ci

Solution

Use:

[testenv]
deps =
  setuptools==5.4.1  # Or whatever version you need
commands =
  nosetests

Problem

I'm trying to develop a python program with a recent version of setuptools. But every time my build fails with the following message: ``` $ tox -e $TOX_ENV GLOB sdist-make: /home/travis/build/kartoch/myapp/setup.py py26 create: /home/travis/build/kartoch/myapp/.tox/py26 py26 inst: /home/travis/build/kartoch/myapp/.tox/dist/myapp-0.1.0.zip ERROR: invocation failed, logfile: /home/travis/build/kartoch/myapp/.tox/py26/log/py26-1.log [...] Unpacking ./.tox/dist/myap-0.1.0.zip Running setup.py (path:/tmp/pip-P4VhFx-build/setup.py) egg_info for package from file:///home/travis/build/kartoch/myapp/.tox/dist/myapp-0.1.0.zip The required version of setuptools (>=5.4.1) is not available, and can't be installed while this script is running. Please install a more recent version first, using 'easy_install -U setuptools'. (Currently using setuptools 3.6 (/home/travis/build/kartoch/myapp/.tox/py26/lib/python2.6/site-packages)) Complete output from command python setup.py egg_info: ``` So far the problem is: - updating / re-install setuptools in travis.yml has no effect, as 'virtualenv' generated by tox has previous setuptools - cannot upgrade / re-install setuptools before the call to setup.py by tox (dependencies are installed after this step) Any idea ? I'm launching my tests with the following'.travis.yml': ``` language: python env: - TOX_ENV=py26 - TOX_ENV=py27 install: - pip install tox script: - tox -e $TOX_ENV ``` The tox configuration ('tox.ini') is the following: ``` [tox] envlist = py26, py27 [testenv] commands = nosetests [testenv:py26] [testenv:py27] ```

Original source