Skip to content

Instantly share code, notes, and snippets.

View andymgibson's full-sized avatar

Andy Gibson andymgibson

  • La Jolla
  • 08:24 (UTC -07:00)
View GitHub Profile
@andymgibson
andymgibson / conda_environment_check.py
Last active October 14, 2025 16:05
Environment check I use before imports to ensure I don't install anything to base or the wrong env by accident
# enviornment check specific to my computer (just change "spikes" to your environment)
import os
# checks if we're in the right conda environment
current_env = os.environ.get('CONDA_DEFAULT_ENV', 'unknown')
if current_env != 'spikes':
print(f'Detected incorrect environment: {current_env}')
print("Run 'conda activate spikes' first")