| name | simpo-environment-setup |
| description | How to set up the correct Python environment for the SimPO project, specifically using Python 3.10 and resolving version conflicts. Use this when setting up the environment to run SimPO code and unit tests. |
SimPO Environment Setup
Critical: Use Python 3.10
The SimPO project and its tests require Python 3.10. If the system has a different Python version (e.g., 3.12), you must install and use Python 3.10 explicitly.
Step-by-step Setup
uv python install 3.10
cd /root/SimPO
uv venv --python 3.10 .venv
source .venv/bin/activate
python -VV
pip install torch torchvision torchaudio
pip install transformers trl accelerate datasets
pip install numpy
Generate python_info.txt
python -VV > /root/python_info.txt 2>&1
python -m pip freeze >> /root/python_info.txt
Run the Unit Test
cd /root/SimPO
python unit_test/unit_test_1.py
This will generate /root/loss.npz with key 'losses'.
Common Issues
- Wrong Python version: If
/root/python_info.txt shows Python 3.12, the test will fail. Always verify python -VV shows 3.10.
- Package conflicts: If system packages conflict, create a clean venv with Python 3.10.
- CUDA availability: The unit test may run on CPU. Ensure torch is installed correctly for the available hardware.
- uv tool: If
uv is available, it's the easiest way to install a specific Python version:
uv python install 3.10
uv venv --python 3.10 /root/SimPO/.venv
- Alternative with conda:
conda create -n simpo python=3.10 -y
conda activate simpo
pip install torch transformers trl accelerate datasets numpy