File size: 3,629 Bytes
24ef614 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# 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 |