Skip to content

conda bin_paths are missing Library\... subdirectories on windows #514

@arrjaytee

Description

@arrjaytee

Describe the bug

When running python code that requires external executables from conda packages - i.e. ipopt, they cannot be found on the PATH.

How to reproduce

This noxfile fails - it should find 'ipopt.exe' on the PATH:

import nox

@nox.session(python="3.7", venv_backend="conda")
def conda_path_bug(session):
    session.conda_install("conda-forge::ipopt==3.11.1")  
    session.run("python", "-c", "import shutil; assert shutil.which('ipopt')")

Expected behavior

The PATH should be set to include the same entries as Anaconda's cwp.py provides:

new_paths = pathsep.join([prefix,
                         join(prefix, "Library", "mingw-w64", "bin"),
                         join(prefix, "Library", "usr", "bin"),
                         join(prefix, "Library", "bin"),
                         join(prefix, "Scripts")])
env = os.environ.copy()
env['PATH'] = new_paths + pathsep + env['PATH']
env['CONDA_PREFIX'] = prefix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions