AI-lab Python dependency conflicts (pip/torch version errors)
Python dependency errors in AI-lab are usually caused by an unsupported Python version, an outdated pip, or a PyTorch build that does not match your system or hardware.
RECOMMENDED FIX: USE A CLEAN VIRTUAL ENVIRONMENT
Rather than changing your existing environment, create a new one.
macOS and Linux:
python3 -m venv ai-lab-env
source ai-lab-env/bin/activate
Windows:
py -m venv ai-lab-env
ai-lab-env\Scripts\activate
Upgrade the packaging tools inside the new environment:
python -m pip install --upgrade pip setuptools wheel
Then reinstall the AI-lab dependencies:
pip install -r requirements.txt
PYTORCH INSTALLATION ERRORS
PyTorch packages must match your operating system, Python version, and hardware. Installing the wrong build is the most common cause of torch version errors.
-
Check your Python version:
python --version
-
Remove any conflicting PyTorch packages:
pip uninstall -y torch torchvision torchaudio
-
Install the correct build.
For a CPU-only installation:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
For an NVIDIA GPU installation, use the command generated on the official PyTorch page for your CUDA version:
https://pytorch.org/get-started/locally/
Do not install a CUDA-enabled PyTorch package unless your NVIDIA driver supports the CUDA version you selected.
VERIFY THE INSTALLATION
python -c "import torch; print(torch.__version__); print(torch.cuda.is_available())"
pip check
The pip check command reports any dependency conflicts that remain in the environment.
IF THE PROBLEM CONTINUES
Delete the virtual environment, recreate it, and install the dependencies again from scratch. Avoid mixing conda and pip packages in the same environment unless the project specifically requires it.
INFORMATION TO INCLUDE WHEN CONTACTING SUPPORT
-
Operating system and version
-
Python version
-
Output of: pip --version
-
Output of: pip check
-
The full error message
-
Whether you are using CPU, NVIDIA CUDA, or Apple Silicon
-
The exact installation command you ran