tox-dev / tox

Command line driven CI frontend and development task automation tool.
https://tox.wiki
MIT License
3.66k stars 518 forks source link

Tox fails to create python 3.3 venv #169

Closed pytoxbot closed 7 years ago

pytoxbot commented 8 years ago

While trying to create a virtualenv for python 3.3 I'm getting the following error:

% tox --develop -v --recreate -e py33
using tox.ini: /Users/dwt/Code/Projekte/pyexpect/tox.ini
using tox-1.7.1 from /Users/dwt/Library/Python/2.7/lib/python/site-packages/tox-1.7.1-py2.7.egg/tox/__init__.pyc
py33 recreate: /Users/dwt/Code/Projekte/pyexpect/.tox/py33
ERROR: UnsupportedInterpreter: python2.5 is not supported anymore, sorry
___________ summary ____________
ERROR:   py33: UnsupportedInterpreter: python2.5 is not supported anymore, sorry

What is supposed to happen is this:

% PYTHONPATH='' tox --develop -v --recreate -e py33
using tox.ini: /Users/dwt/Code/Projekte/pyexpect/tox.ini
using tox-1.7.1 from /Users/dwt/Library/Python/2.7/lib/python/site-packages/tox-1.7.1-py2.7.egg/tox/__init__.pyc
py33 recreate: /Users/dwt/Code/Projekte/pyexpect/.tox/py33
  /Users/dwt/Code/Projekte/pyexpect/.tox$ /usr/bin/python -mvirtualenv --setuptools --python /Users/dwt/Library/Homebrew/bin/python3.3 py33 >/Users/dwt/Code/Projekte/pyexpect/.tox/py33/log/py33-0.log
py33 develop-inst: /Users/dwt/Code/Projekte/pyexpect
  /Users/dwt/Code/Projekte/pyexpect$ /Users/dwt/Code/Projekte/pyexpect/.tox/py33/bin/pip install --pre -e /Users/dwt/Code/Projekte/pyexpect >/Users/dwt/Code/Projekte/pyexpect/.tox/py33/log/py33-1.log
py33 runtests: PYTHONHASHSEED='1252960215'
py33 runtests: commands[0] | /Users/dwt/Code/Projekte/pyexpect/.tox/py33/bin/python pyexpect.py
  /Users/dwt/Code/Projekte/pyexpect$ /Users/dwt/Code/Projekte/pyexpect/.tox/py33/bin/python pyexpect.py 
..................................
----------------------------------------------------------------------
Ran 34 tests in 0.272s

OK
___________ summary ____________
  py33: commands succeeded
  congratulations :)

My tox file specifies this variable:

[tox]
envlist = py26, py27, py33
#, pypy

[testenv]
commands = {envpython} pyexpect.py

[testenv:py33]
setenv =
    PYTHONPATH = 

So it seems tox is missing to actually hand in that virtualenv variable to the python 3.3 in question.

pytoxbot commented 8 years ago

Original comment by halwine

This can all be handled in pyenv - you set all needed (multiple) interpreters as active. See pyenv issue 92 for details.

pytoxbot commented 8 years ago

Original comment by @blueyed

tox 1.8 has improvements in this regard (commit 085b6e2), and might raise "Failed to get version_info for ..." in this case instead.

pytoxbot commented 8 years ago

Original comment by @chris-martin

My anecdote, in case anyone else faces the same problem: I saw this error on CircleCI because only one python version is installed by default. Using pyenv to install the other required ones (e.g. pyenv global 3.3.2) fixed it.

pytoxbot commented 8 years ago

Original comment by simlun

I was also using Python 3.x installed via Homebrew

pytoxbot commented 8 years ago

Original comment by @dwt

If you're asking me, I'm running python 3.x installed via homebrew, so no pyenv.

pytoxbot commented 8 years ago

Original comment by @blueyed

Any chance that you are using pyenv?

I am using pyenv, and the problem is that python3.3 is available (as a shim), but executing it results in an error:

pyenv: python3.3: command not found

The `python3.3' command exists in these Python versions: 3.3.5

% pyenv shell 3.4.1
% tox -v -e py33-1.7.x
py33-1.7.x create: venv/src/django-taggit/.tox/py33-1.7.x
> /home/user/.pyenv/versions/3.4.1/lib/python3.4/site-packages/tox/_config.py(190)getsupportedinterpreter()
    189         import ipdb; ipdb.set_trace()
--> 190         if info.version_info < (2,6):
    191             raise tox.exception.UnsupportedInterpreter(

ipdb> l
    185                 "Jython/Windows does not support installing scripts")
    186         info = self.config.interpreters.get_info(self.basepython)
    187         if not info.executable:
    188             raise tox.exception.InterpreterNotFound(self.basepython)
    189         import ipdb; ipdb.set_trace()
--> 190         if info.version_info < (2,6):
    191             raise tox.exception.UnsupportedInterpreter(
    192                 "python2.5 is not supported anymore, sorry")
    193         return info.executable
    194
    195 testenvprefix = "testenv:"

ipdb> info.
info.err           info.executable    info.name          info.out           info.runnable      info.version_info
ipdb> info.executable
local('/home/user/.pyenv/shims/python3.3')
ipdb> info.version_info
ipdb> info.runnable
False
ipdb> info.out
b''
ipdb> info.err
b"pyenv: python3.3: command not found\n\nThe `python3.3' command exists in these Python versions:\n  3.3.5\n\n"

This then results in the following error, because info.version_info is None:

/home/user/.pyenv/versions/3.4.1/lib/python3.4/site-packages/tox/_venv.py in getsupportedinterpreter(self)
    169
    170     def getsupportedinterpreter(self):
--> 171         return self.envconfig.getsupportedinterpreter()
    172
    173     def create(self, action=None):

/home/user/.pyenv/versions/3.4.1/lib/python3.4/site-packages/tox/_config.py in getsupportedinterpreter(self)
    188             raise tox.exception.InterpreterNotFound(self.basepython)
    189         import ipdb; ipdb.set_trace()
--> 190         if info.version_info < (2,6):
    191             raise tox.exception.UnsupportedInterpreter(
    192                 "python2.5 is not supported anymore, sorry")

  TypeError: unorderable types: NoneType() < tuple()

I could imagine that pytest could also raise InterpreterNotFound if the version information is None.

pytoxbot commented 8 years ago

Original comment by simlun

Got the same issue with Python 3.4. It seems to try to use the 2.5 interpreter but crashes. I'm on Mac Mavericks and Python 3.4 was installed via Homebrew. Very weird since it worked yesterday without a problem on 3.4... No clue on what changed today.

$ python --version
Python 2.7.6
$ python3.4 --version
Python 3.4.0
$  tox --version
1.7.1 imported from /usr/local/lib/python2.7/site-packages/tox/__init__.pyc
obestwalter commented 7 years ago

@dwt (cc: @blueyed) I am looking into the whole issue of interpreter discovery and better pyenv, conda, etc. integration/documentation, so I am sifting through existing issues.

I wonder what happened, since this was last discussed. To me it looks like pyenv works smoothly now with tox, if all needed pyenv installed versions are activated in the shell that tox is invoked from. Is this your current experience as well?

r0fls commented 7 years ago

I'm also experiencing this issue, though with python3.6. ERROR: py36: InterpreterNotFound: python3.6

obestwalter commented 7 years ago

HI @r0fls - I am pretty sure that the original issue (with 3.3) is long resolved. The error message was lying and is fixed also now. So whatever you experienced was a different problem. If the problem persists even if you use the newest version of tox please open a new issue and provide details about how to reproduce the problem. Thanks :)