Python 2.6 is no longer supported by the most recent version of `virtualenv`
kolypto opened this issue · 2 comments
I'm trying to use this container to test my library against multiple Python versions with tox.
My tox.ini
file:
[tox]
envlist=py{26,27,34,35,36,37},pypy
skip_missing_interpreters=True
[testenv]
deps=-rrequirements-dev.txt
commands=
nosetests {posargs:tests/}
whitelist_externals=make
[testenv:dev]
deps=-rrequirements-dev.txt
usedevelop=True
With this file, I'm running your container like this:
$ docker run --rm -it -v $(realpath .):/src themattrix/tox
It runs nicely: my package is a volume, and tox is running. However, this is the error I get with Python 2.6: tox can't use the modern virtualenv to create a Python 2.6 testing environment:
GLOB sdist-make: /app/setup.py
py26 create: /app/.tox/py26
ERROR: invocation failed (exit code 101), logfile: /app/.tox/py26/log/py26-0.log
ERROR: actionid: py26
msg: getenv
cmdargs: ['/.pyenv/versions/3.7.0/bin/python', '-m', 'virtualenv', '--python', '/.pyenv/shims/python2.6', 'py26']ERROR: None
ERROR: this script requires Python 2.7 or greater.
Running virtualenv with interpreter /.pyenv/shims/python2.6ERROR: Error creating virtualenv. Note that some special characters (e.g. ':' and unicode symbols) in paths are not supported by virtualenv. Error details: InvocationError('/.pyenv/versions/3.7.0/bin/python -m virtualenv --python /.pyenv/shims/python2.6 py26 (see /app/.tox/py26/log/py26-0.log)', 101)
This has happened because virtualenv
has dropped support for Python 2.6 since 16.0.0.
If I manually install virtualenv==15.2.0
, which supports Python 2.6, there's another error:
root@10ac4fa81171:/src# tox -e py26
GLOB sdist-make: /src/setup.py
py26 create: /src/.tox/py26
py26 installdeps: -rrequirements-dev.txt
ERROR: invocation failed (exit code 1), logfile: /src/.tox/py26/log/py26-1.log
ERROR: actionid: py26
msg: getenv
cmdargs: ['/src/.tox/py26/bin/python', '-m', 'pip', 'install', '-rrequirements-dev.txt']/src/.tox/py26/bin/python: pip is a package and cannot be directly executed
An ugly solution is to add the following line to tox.ini
:
install_command=pip install {opts} {packages}(ARGV)
This gives a new error:
tox.exception.ConfigError: ConfigError: 'install_command' must contain '{packages}' substitution
This is a tox bug. Got to update it first:
$ pip install -U tox
And now, finally, the container works fine.
But it does not have to be like that, does it? :)
Another partial solution that worked for me was to switch to a different Python version.
I ran this inside the container:
$ pyenv local 2.7.15
$ pip install tox
$ /docker-entrypoint.sh tox
This fixed Python 2.6, worked with 2.7, but failed on every Python3 and PyPy.
First things first: Thanks for conceiving docker-tox
, Matthew. We had the pleasure to use it for mqttwarn
and it worked like a charm.
After just adding py26
, py33
and py34
to the list of environments to test with, the build process [1] on CircleCI croaks like that:
GLOB sdist-make: /root/project/setup.py
py26 create: /root/project/.tox/py26
ERROR: invocation failed (exit code 1), logfile: /root/project/.tox/py26/log/py26-0.log
================================== log start ===================================
Traceback (most recent call last):
File "/.pyenv/versions/3.7.5/lib/python3.7/site-packages/virtualenv.py", line 53, in <module>
print("ERROR: {}".format(sys.exc_info()[1]))
ValueError: zero length field name in format
Running virtualenv with interpreter /.pyenv/versions/2.6.9/bin/python2.6
=================================== log end ====================================
ERROR: InvocationError for command /.pyenv/versions/3.7.5/bin/python -m virtualenv --no-download --python /.pyenv/versions/2.6.9/bin/python2.6 py26 (exited with code 1)