-
-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Labels
Description
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