Skip to content

Running Tox inside a pyenv virutalenv #21

@andymccurdy

Description

@andymccurdy

It seems like you can't use Tox to test against multiple Python versions inside of a virtualenv created with pyenv-virtualenv. From what I can tell, this is because activating a pyenv-virtualenv sets the PYENV_VERSION to the named virtualenv, which makes all the other pythonX.Y shims invalid.

A complete example demonstrating this problem:

$> pyenv install 2.7.6
$> pyenv install 3.4.1
$> pyenv global 2.7.6 3.4.1
$> pyenv versions
  system
* 2.7.6 (set by /Users/andy/.pyenv/version)
* 3.4.1 (set by /Users/andy/.pyenv/version)

# NOTE, installing tox "globally" here and running it
# against 2.7.6 and 3.4.1 works fine because both
#2.7.6 and 3.4.1 are "activated" in the non-virtualenv
# environment

$> pyenv virtualenv 2.7.6 redis-py
$> pyenv activate redis-py
$> pyenv versions
  system
  2.7.6
  3.4.1
* redis-py (set by PYENV_VERSION environment variable)

# Now Tox (or any other program trying to call python3.4) will fail

$> python3.4
pyenv: python3.4: command not found

The `python3.4' command exists in these Python versions:
  3.4.1

I've gotten around this problem by using pyenv-virtualenvwrapper, which doesn't seem to use the pyenv versions system to create the virtualenv and doesn't set the PYENV_VERSION environment variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions