Environment Setup Guide
This guide explains how to set up the development environment for the Neurological LRD Analysis project.
Quick Setup
Run the automated setup script:
bash scripts/setup_venv.sh
This script will:
Check for Python 3.11+ compatibility
Create a virtual environment named
neurological_envInstall all required dependencies
Install development and optional dependencies
Manual Setup
If you prefer to set up the environment manually:
1. Create Virtual Environment
python3 -m venv neurological_env
2. Activate Virtual Environment
Linux/macOS:
source neurological_env/bin/activate
Windows:
neurological_env\Scripts\activate
3. Install Dependencies
# Upgrade pip
pip install --upgrade pip
# Install project in development mode
pip install -e .
# Install development dependencies
pip install pytest pytest-cov pytest-html pytest-json-report pytest-timeout black isort flake8 mypy
# Install optional dependencies for enhanced functionality
pip install jax jaxlib numba scikit-learn matplotlib seaborn pywavelets
Environment Management
Activating the Environment
Before working on the project, always activate the virtual environment:
source neurological_env/bin/activate # Linux/macOS
# or
neurological_env\Scripts\activate # Windows
You should see (neurological_env) at the beginning of your command prompt when the environment is active.
Deactivating the Environment
To deactivate the virtual environment:
deactivate
Checking Environment Status
To verify the environment is working correctly:
# Check Python version (should be 3.11+)
python --version
# Check installed packages
pip list
# Run tests to verify installation
python -m pytest tests/ -v
Project Structure
The virtual environment (neurological_env/) should be created in the project root directory:
neurological_lrd_analysis/
├── neurological_env/ # Virtual environment (created by setup)
├── neurological_lrd_analysis/ # Main package directory
├── docs/ # Documentation
├── scripts/ # Setup and demo scripts
├── tests/ # Test suite
├── pyproject.toml # Project configuration
└── README.md # Project overview
Troubleshooting
Python Version Issues
If you encounter Python version issues:
Check your Python version:
python3 --versionEnsure you have Python 3.11 or later installed
If using a different Python version, specify it explicitly:
python3.11 -m venv neurological_env
Permission Issues
If you encounter permission issues with the setup script:
chmod +x scripts/setup_venv.sh
bash scripts/setup_venv.sh
Dependency Installation Issues
If some dependencies fail to install:
Update pip:
pip install --upgrade pipTry installing dependencies individually:
pip install numpy scipy pandas pip install jax jaxlib pip install numba
Environment Not Found
If the virtual environment is not found:
Ensure you’re in the project root directory
Check if the
neurological_env/directory existsRecreate the environment if necessary:
rm -rf neurological_env bash scripts/setup_venv.sh
Development Workflow
Activate environment:
source neurological_env/bin/activateMake changes to the code
Run tests:
python -m pytest tests/ -vTest functionality:
python scripts/biomedical_scenarios_demo.pyDeactivate when done:
deactivate
IDE Integration
VS Code
Open the project in VS Code
Press
Ctrl+Shift+P(orCmd+Shift+Pon macOS)Type “Python: Select Interpreter”
Choose the interpreter from
./neurological_env/bin/python
PyCharm
Open the project in PyCharm
Go to File → Settings → Project → Python Interpreter
Click the gear icon → Add
Choose “Existing environment”
Select
./neurological_env/bin/python
Notes
The virtual environment name
neurological_envis appropriate for this projectAll dependencies are specified in
pyproject.tomlThe project uses Python 3.11+ for compatibility with advanced ML and JAX libraries
Lazy imports are implemented to reduce startup time and memory usage