Skip to content

Commit 91ca325

Browse files
committed
Add venv check for conda/mamba
1 parent 27410ce commit 91ca325

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/install_requirements.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ def hasWhitespace(string):
6868
ARTIFACTORY_URL = 'https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local'
6969

7070
# Check if in virtual environment
71-
in_venv = getattr(sys, "real_prefix", getattr(sys, "base_prefix", sys.prefix)) != sys.prefix
71+
in_venv = any([
72+
"VIRTUAL_ENV" in os.environ, # Virtualenv
73+
"PIPENV_ACTIVE" in os.environ, # Pipenv
74+
"CONDA_PREFIX" in os.environ, # Conda/Mamba
75+
getattr(sys, "real_prefix", getattr(sys, "base_prefix", sys.prefix)) != sys.prefix # Standard venv detection
76+
])
77+
7278
pip_call = [sys.executable, "-m", "pip"]
7379
pip_installed = True
7480
pip_install = pip_call + ["install", "-U"]

0 commit comments

Comments
 (0)