pglass/tox-pip-version

InterpreterError when it uses with tox-conda

Closed this issue · 6 comments

Hi there,

I notice when I use tox-conda and tox-pip-version, tox returns interpreter error, below a MWE:

tox.ini with tox-pip-version disabled

[tox]
requires =
    tox-conda
    # tox-pip-version
minversion = 3.10.0
envlist = py{35, 36}
indexserver =
    default = https://pypi.org/simple

[testenv]
# pip_version = 18
sitepackages = False
list_dependencies_command=python -s -m pip freeze
commands =
    python -s -c "import sys;print(sys.version)"

output

base ❯ tox
.tox recreate: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tox
.tox installdeps: tox-conda, tox >= 3.10.0
GLOB sdist-make: /home/mgreco/gitlab/snakes/kalmanfilter/setup.py
py35 recreate: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/py35
py35 inst: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tmp/package/2/kalmanfilter-0+untagged.4.gf42696a.dirty.zip
py35 installed: You are using pip version 10.0.1, however version 20.0.2 is available.,You should consider upgrading via the 'pip install --upgrade pip' command.,certifi==2018.8.24,kalmanfilter==0+untagged.1.g91791c9,numpy==1.18.1
py35 run-test-pre: PYTHONHASHSEED='2823131812'
py35 run-test: commands[0] | python -s -c 'import sys;print(sys.version)'
3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 21:41:56)
[GCC 7.3.0]
py36 recreate: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/py36
py36 inst: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tmp/package/2/kalmanfilter-0+untagged.4.gf42696a.dirty.zip
py36 installed: certifi==2019.11.28,kalmanfilter==0+untagged.1.g91791c9,numpy==1.18.1
py36 run-test-pre: PYTHONHASHSEED='2823131812'
py36 run-test: commands[0] | python -s -c 'import sys;print(sys.version)'
3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 21:14:29)
[GCC 7.3.0]
___________________________________________________________________ summary ___________________________________________________________________
  py35: commands succeeded
  py36: commands succeeded
  congratulations :)

tox.ini with tox-pip-version enabled

[tox]
requires =
    tox-conda
    tox-pip-version
minversion = 3.10.0
envlist = py{35, 36}
indexserver =
    default = https://pypi.org/simple

[testenv]
pip_version = 18
sitepackages = False
list_dependencies_command=python -s -m pip freeze
commands =
    python -s -c "import sys;print(sys.version)"

output

base ❯ tox
.tox recreate: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tox
.tox installdeps: tox-conda, tox-pip-version, tox >= 3.10.0
GLOB sdist-make: /home/mgreco/gitlab/snakes/kalmanfilter/setup.py
py35 recreate: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/py35
ERROR: InterpreterNotFound: python3.5
py36 inst-nodeps: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tmp/package/2/kalmanfilter-0+untagged.4.gf42696a.dirty.zip
py36 installed: certifi==2019.11.28,kalmanfilter==0+untagged.1.g91791c9,numpy==1.18.1
py36 run-test-pre: PYTHONHASHSEED='3199308224'
py36 run-test: commands[0] | python -s -c 'import sys;print(sys.version)'
3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 21:14:29)
[GCC 7.3.0]
___________________________________________________________________ summary ___________________________________________________________________
ERROR:  py35: InterpreterNotFound: python3.5
  py36: commands succeeded

Thanks!

It looks like tox-conda uses a conflicting tox plugin hook method, similar to tox-venv: https://github.com/tox-dev/tox-conda/blob/master/tox_conda/plugin.py#L91. I think we can support tox-conda using a similar approach as tox-venv. I'll try to get a PR up later today.

I have a PR up which I think fixes this. I just need to add test cases, which I'll try to get to tomorrow.

I gave it a manual test with miniconda and your tox.ini file and I see it succeeded, but is not the exact same versions/environment.

@mmngreco If you have a chance, it would help if you can test the PR by installing the version below, which contains the fix. And then rerun tox.

pip install git+https://github.com/pglass/tox-pip-version.git@support-tox-conda

If that version of tox-pip-version fixes things for you, I'll make a release immediately with the fix.

Yes, of course! I'll let you know when I have tested it.

I have some dificulties using the PR branch. I've just resolved by doing:

installing

. .tox/.tox/bin/activate
python -m pip install git+https://github.com/pglass/tox-pip-version.git@support-tox-conda
tox 

tox.ini

[tox]
requires =
    tox-conda
    tox-pip-version
minversion = 3.10.0
envlist = py{35, 36}
indexserver =
    default = https://pypi.org/simple

[testenv]
pip_version = 18
sitepackages = False
list_dependencies_command=python -s -m pip freeze
commands =
    python -s -c "import sys;print(sys.version)"

output

base ❯ tox
GLOB sdist-make: /home/mgreco/gitlab/snakes/kalmanfilter/setup.py
py35 recreate: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/py35
py35: pip_version is pip==18
py35 inst: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tmp/package/2/kalmanfilter-0+untagged.8.g70c7853.dirty.zip
py35 installed: You are using pip version 18.0, however version 20.0.2 is available.,You should consider upgrading via the 'pip install --upgrade pip' command.,certifi==2018.8.24,kalmanfilter==0+untagged.1.g91791c9,numpy==1.18.1
py35 run-test-pre: PYTHONHASHSEED='489985746'
py35 run-test: commands[0] | python -s -c 'import sys;print(sys.version)'
3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 21:41:56)
[GCC 7.3.0]
py36 inst-nodeps: /home/mgreco/gitlab/snakes/kalmanfilter/.tox/.tmp/package/2/kalmanfilter-0+untagged.8.g70c7853.dirty.zip
py36 installed: kalmanfilter==0+untagged.1.g91791c9,numpy==1.18.1
py36 run-test-pre: PYTHONHASHSEED='489985746'
py36 run-test: commands[0] | python -s -c 'import sys;print(sys.version)'
3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0]
_________________________________________________________________ summary __________________________________________________________________
  py35: commands succeeded
  py36: commands succeeded
  congratulations :)

So, it seems to work fine now! :-)

@mmngreco I released a new version with the fix: https://pypi.org/project/tox-pip-version/0.0.7/

Let me know if there are any issues. Thanks!