Skip to content

Issues with virtual environment reuse and multiple Python versions installed through pyenv #441

@purefunctor

Description

@purefunctor

Describe the bug
G'day, Nox 2021.6.6 seems to fail reusing environments when it finds multiple Python interpreters installed by pyenv. Perhaps this is related to #428 ?

How to reproduce
Install multiple versions with pyenv

$ pyenv install 3.8.9
$ pyenv install 3.9.5
$ pyenv global 3.9.5 3.8.9

This populates ~/.pyenv/shims/ with the following with executable scripts e.g. python, python3.9, python3.8, etc. This folder is typically added to PATH.

Running the following session breaks virtual environment reuse:

@nox.session(python="3.9")
def test(session):
    session.install("pytest", ".")
    session.run("pytest")

Installing/running nox using poetry or a manually-created virtualenv environment in a project seems to resolve this, however.

Expected behavior
Virtual environments are reused in the presence of pyenv-installed Python versions.

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