| # PyTorch Python 3.10 Installation Guide | |
| ## π Quick Start | |
| ### Option 1: Automated Setup (Recommended) | |
| ```bash | |
| # 1. Create conda environment | |
| conda create -n pytorch_env python=3.10 | |
| conda activate pytorch_env | |
| # 2. Download repository | |
| git clone https://huggingface.co/RDHub/pytorch_python_310 | |
| cd pytorch_python_310 | |
| # 3. Install all packages | |
| pip install -r lib_wheel/requirements.txt --find-links lib_wheel --no-index | |
| # 4. Set up CUDA libraries | |
| bash setup_cuda_libs.sh | |
| # 5. Test installation | |
| python -c "import torch; print(f'PyTorch {torch.__version__} - CUDA: {torch.cuda.is_available()}')" | |
| ``` | |
| ### Option 2: Manual Setup | |
| ```bash | |
| # 1. Install packages | |
| pip install -r lib_wheel/requirements.txt --find-links lib_wheel --no-index | |
| # 2. Create CUDA library activation script | |
| mkdir -p $CONDA_PREFIX/etc/conda/activate.d | |
| cat > $CONDA_PREFIX/etc/conda/activate.d/pytorch_cuda_libs.sh << 'EOF' | |
| #!/bin/bash | |
| NVIDIA_LIB_PATH=$(find $CONDA_PREFIX -path "*/nvidia/*/lib" -type d 2>/dev/null | tr '\n' ':') | |
| CUSPARSELT_LIB_PATH=$(find $CONDA_PREFIX -path "*/cusparselt/lib" -type d 2>/dev/null | tr '\n' ':') | |
| export LD_LIBRARY_PATH="${NVIDIA_LIB_PATH}${CUSPARSELT_LIB_PATH}${LD_LIBRARY_PATH}" | |
| EOF | |
| chmod +x $CONDA_PREFIX/etc/conda/activate.d/pytorch_cuda_libs.sh | |
| # 3. Reactivate environment | |
| conda deactivate && conda activate your_env_name | |
| ``` | |
| ## β What's Included | |
| - **PyTorch 2.7.1** with CUDA 12.6 support | |
| - **Transformers 4.52.3** for HuggingFace models | |
| - **NumPy 2.0.2** (compatible with OpenCV) | |
| - **OpenCV 4.10.0** for computer vision | |
| - **80+ compatible packages** tested together | |
| - **NVIDIA CUDA libraries** (12.6.x series) | |
| ## π§ͺ Testing Your Installation | |
| ```python | |
| import torch | |
| import transformers | |
| import numpy as np | |
| import cv2 | |
| # Test PyTorch CUDA | |
| print(f"PyTorch: {torch.__version__}") | |
| print(f"CUDA Available: {torch.cuda.is_available()}") | |
| if torch.cuda.is_available(): | |
| print(f"GPU: {torch.cuda.get_device_name(0)}") | |
| # Test basic operations | |
| x = torch.randn(100, 100).cuda() | |
| y = torch.matmul(x, x.T) | |
| print("β GPU tensor operations working!") | |
| # Test transformers | |
| from transformers import AutoTokenizer | |
| tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") | |
| print("β Transformers working!") | |
| print(f"NumPy: {np.__version__}") | |
| print(f"OpenCV: {cv2.__version__}") | |
| ``` | |
| ## π§ Troubleshooting | |
| ### Issue: "libcufile.so.0: cannot open shared object file" | |
| **Solution:** Run the CUDA setup script: | |
| ```bash | |
| bash setup_cuda_libs.sh | |
| conda deactivate && conda activate your_env_name | |
| ``` | |
| ### Issue: "libcusparseLt.so.0: cannot open shared object file" | |
| **Solution:** Ensure all NVIDIA packages are installed: | |
| ```bash | |
| pip install --force-reinstall lib_wheel/nvidia_cusparselt_cu12-*.whl | |
| pip install --force-reinstall lib_wheel/nvidia_cufile_cu12-*.whl | |
| ``` | |
| ### Issue: OpenCV + NumPy compatibility errors | |
| **Solution:** Use the exact versions provided: | |
| ```bash | |
| pip install --force-reinstall lib_wheel/numpy-2.0.2-*.whl | |
| pip install --force-reinstall lib_wheel/opencv_python-4.10.0.84-*.whl | |
| ``` | |
| ## π System Requirements | |
| - **OS:** Linux x86_64 (Ubuntu 22.04+ recommended) | |
| - **Python:** 3.10 | |
| - **CUDA:** Compatible with 12.2+ (12.6 optimal) | |
| - **Conda:** Required for library path management | |
| - **Storage:** ~2GB for all wheels | |
| ## π― Verified Configurations | |
| β **Ubuntu 22.04** + Python 3.10 + CUDA 12.2 | |
| β **Ubuntu 22.04** + Python 3.10 + CUDA 12.6 | |
| β **RTX 4090** + CUDA 12.6 | |
| β **Conda environments** | |
| ## π Resources | |
| - **Repository:** https://huggingface.co/RDHub/pytorch_python_310 | |
| - **PyTorch Docs:** https://pytorch.org/docs/ | |
| - **CUDA Toolkit:** https://developer.nvidia.com/cuda-toolkit |