Skip to content

Add venv check for conda/mamba #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ def hasWhitespace(string):
ARTIFACTORY_URL = 'https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local'

# Check if in virtual environment
in_venv = getattr(sys, "real_prefix", getattr(sys, "base_prefix", sys.prefix)) != sys.prefix
in_venv = any([
"VIRTUAL_ENV" in os.environ, # Virtualenv
"PIPENV_ACTIVE" in os.environ, # Pipenv
"CONDA_PREFIX" in os.environ, # Conda/Mamba
getattr(sys, "real_prefix", getattr(sys, "base_prefix", sys.prefix)) != sys.prefix # Standard venv detection
])

pip_call = [sys.executable, "-m", "pip"]
pip_installed = True
pip_install = pip_call + ["install", "-U"]
Expand Down
Loading