tox is not creating environment py34 "InterpreterNotFound"

Created on 7 Oct 2016  路  13Comments  路  Source: tox-dev/tox

Hi,
I already used tox successfully earlier, but just now it does not seem to work in the same way it did before.
I created a minimal example:
tox.ini

[tox]
envlist = py34

setup.py

from setuptools import setup
setup()

I execute tox by simply typing tox in the anaconda prompt.
I actually tried the more on the list from https://testrun.org/tox/latest/example/basic.html
It's the same problem if I try: py35, py34, py33,py26,py27

I get the Error message:
ERROR: InterpreterNotFound: python3.4
Why does tox behave like this? I use tox 2.3.1 in python 3.5.
I also tried this with the actual tox from this repository. Still the same.

I expect tox to create the respective virtual environment that I list in envlist and then installing my package to every environment.

Hope to get some help here!

Most helpful comment

I know this issue old, but I experienced this problem when trying to run tox with Miniconda on Windows 10 (installed at C:\Users\Miniconda3) for Python 3.6.

In the tox.ini file, changing the notation from py36 to python3.6 worked for me.

Hopefully that helps someone else that stumbles upon this.

All 13 comments

I'm not sure if tox works with anaconda - but what happens when you run python3.4 in the same prompt?

are those python versions availiable to tox from anaconda? if not, you are trying something fundamentally impossible

i am not familiar with anaconda myself

I'm not sure if tox works with anaconda - but what happens when you run python3.4 in the same prompt?

It doesn't. Same behaviour in windows cmd.
To use python 3.4 I need to change to my py34 virtual env and there run python.

are those python versions availiable to tox from anaconda? if not, you are trying something fundamentally impossible

They are available. I do have virtual environments of these versions. My main python is python 3.5.

This will sdist-package your current project, create two virtualenv Environments, install the sdist-package into the environments and run the specified command in each of them

This is, what I catch from the docs, should be done. So by specifying py34 in my envlist in my tox.ini tox should be creating the virtualenv itself?!

@friederikemeier tox is not aware of other conda python versions - if they are not available from the current environment its not going to work

there is a plan to make tox support actual conda envs, but the people working on those details are short on time to actually do it

@nicoddemus is more well versed on the topic than me

also don't know anaconda much but if you can modify the PATH environment variable to contain the directory where your python3.4 executable resides, and you then start tox, it should work.

If there is a programmatic way to get at anaconda envs then someone could write a tox-anaconda plugin which implements the tox_get_python_executable hook. This doesn't require modifying PATH then and just installing such a plugin would make it discoverable.

CCin @flub as well to see if he has anything to add/say ...

So if you simply want your (ana)conda python versions to be used by tox when using the py27,py34 etc tox envs you need to create those first as conda envs and then put them on the path. A simple way to do this is to do conda create -n tox-py27 python=2.7; conda create -n tox-py35 python=3.5 etc. Then create a central bin directory, say ~/bin and create symlinks to wherever those tox envs live: ln -s /path/to/conda/installation/envs/tox-py27/bin/python2.7 etc. Finally you then add that bin directory to your PATH and tox will find and use those tox-provided python binaries.

And as already mentioned, better integration of conda and tox is on the cards but waiting for someone to have to time to work on it. The tox_get_python_executable plugin idea from @hpk42 above does sound like a nice thing to do as well and should be a lot easier and would tick this use case.

closing this issue. rationale: tox can only find interpreters that are on the path unless plugins discover more. So the problem with conda integration is one of writing a plugin and not really the headline of the issue here. Note also that there is a plugin from @AvdN https://pypi.python.org/pypi/tox-globinterpreter which allows to find interpretesr in non-path places.

I know this issue old, but I experienced this problem when trying to run tox with Miniconda on Windows 10 (installed at C:\Users\Miniconda3) for Python 3.6.

In the tox.ini file, changing the notation from py36 to python3.6 worked for me.

Hopefully that helps someone else that stumbles upon this.

@glinskyc Using python3.6 instead of py36 was not working for me on Linux, as python3.7 was used instead. The symptom I had was that thetensorflow dependency couldn't be installed, because it has no wheels for Python 3.7 (yet). This version of Python was used by Tox because it is the default on my system. Therefore, I am afraid that using pythonX.Y instead of pyXY is not the solution when using Conda.

This article explains how things should be set up to use Tox with Conda on Windows.

In fact, tox is complaining that it doesn't find python3.6 at its standard location. On Windows, you need to setup the python versions manually with conda create -p C:\Python36 python=3.6.

Tox will also need virtualenv. Install it with conda install virtualenv, as the other version that comes from pypi.org doesn't work properly within Anaconda.

@glinskyc Your hint was the only way for me to run tox in pycharm environment over multiple versions of python. I was lucky to find your comment here after many hours of trying. Many warm kudos to you, sir.

@glinskyc hint was working for me on an Alpine Linux Python 3.7 Docker image. Thank you.

switching to py3.6.9 from py369 fixed the problem I was having on the Azure DevOps ubuntu build agent, Strangely py367 worked just fine for more than a month.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pytoxbot picture pytoxbot  路  5Comments

gaborbernat picture gaborbernat  路  4Comments

obestwalter picture obestwalter  路  3Comments

pytoxbot picture pytoxbot  路  5Comments

obestwalter picture obestwalter  路  5Comments