Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update setuptools on tox during travis build

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]
like image 280
Kartoch Avatar asked Jul 12 '14 15:07

Kartoch


People also ask

Do I need to install Setuptools?

you generally don't need to worry about setuptools - either it isn't really needed, or the high-level installers will make sure you have a recent enough version installed; in this last case, as long as the operations they have to do are simple enough generally they won't fail.


3 Answers

Use:

[testenv]
deps =
  setuptools==5.4.1  # Or whatever version you need
commands =
  nosetests
like image 198
Thomas Orozco Avatar answered Oct 15 '22 03:10

Thomas Orozco


I was able to solve this by adding an updated setuptools to the install section:

install:
  - pip install -U pip wheel
  - pip install setuptools==24.0.3
  - pip install -r ourapp/requirements/requirements.txt
like image 32
shacker Avatar answered Oct 15 '22 05:10

shacker


In the tox.ini:

deps =
    setuptools=38.2.5

It will block the initial python installation with this version within the tox environment. Then avec it will install the one required by the egg.

like image 44
encolpe Avatar answered Oct 15 '22 03:10

encolpe