https://pytorch.org/get-started/locally/
zzh@ZZHPC:~/zd/Github$ python -m venv zpytorch (venv创建后不能移动到别的地方,移动到别的地方后虽然仍能activate,但activate之后python和pip也不再是zpytorch下的python和pip)
zzh@ZZHPC:~/zd/Github$ cd zpytorch/ zzh@ZZHPC:~/zd/Github/zpytorch$ source bin/activate (zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ command -v python /zdata/Github/zpytorch/bin/python (zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ command -v pip /zdata/Github/zpytorch/bin/pip (zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 Looking in indexes: https://download.pytorch.org/whl/cu124 Collecting torch Downloading https://download.pytorch.org/whl/cu124/torch-2.4.1%2Bcu124-cp312-cp312-linux_x86_64.whl (797.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 797.1/797.1 MB 1.1 MB/s eta 0:00:00 Collecting torchvision Downloading https://download.pytorch.org/whl/cu124/torchvision-0.19.1%2Bcu124-cp312-cp312-linux_x86_64.whl (7.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.1/7.1 MB 1.8 MB/s eta 0:00:00 Collecting torchaudio Downloading https://download.pytorch.org/whl/cu124/torchaudio-2.4.1%2Bcu124-cp312-cp312-linux_x86_64.whl (3.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 1.8 MB/s eta 0:00:00 Collecting filelock (from torch) Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB) Collecting typing-extensions>=4.8.0 (from torch) Downloading https://download.pytorch.org/whl/typing_extensions-4.9.0-py3-none-any.whl (32 kB) Collecting sympy (from torch) Downloading https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl (5.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 1.5 MB/s eta 0:00:00 Collecting networkx (from torch) Downloading https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 1.7 MB/s eta 0:00:00 Collecting jinja2 (from torch) Downloading https://download.pytorch.org/whl/Jinja2-3.1.3-py3-none-any.whl (133 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.2/133.2 kB 2.9 MB/s eta 0:00:00 Collecting fsspec (from torch) Downloading https://download.pytorch.org/whl/fsspec-2024.2.0-py3-none-any.whl (170 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 170.9/170.9 kB 1.7 MB/s eta 0:00:00 Collecting setuptools (from torch) Downloading https://download.pytorch.org/whl/setuptools-70.0.0-py3-none-any.whl (863 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 863.4/863.4 kB 1.3 MB/s eta 0:00:00 Collecting nvidia-cuda-nvrtc-cu12==12.4.99 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cuda_nvrtc_cu12-12.4.99-py3-none-manylinux2014_x86_64.whl (24.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.7/24.7 MB 1.3 MB/s eta 0:00:00 Collecting nvidia-cuda-runtime-cu12==12.4.99 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cuda_runtime_cu12-12.4.99-py3-none-manylinux2014_x86_64.whl (883 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 883.4/883.4 kB 1.5 MB/s eta 0:00:00 Collecting nvidia-cuda-cupti-cu12==12.4.99 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cuda_cupti_cu12-12.4.99-py3-none-manylinux2014_x86_64.whl (13.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.8/13.8 MB 1.7 MB/s eta 0:00:00 Collecting nvidia-cudnn-cu12==9.1.0.70 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl (664.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 664.8/664.8 MB 961.9 kB/s eta 0:00:00 Collecting nvidia-cublas-cu12==12.4.2.65 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cublas_cu12-12.4.2.65-py3-none-manylinux2014_x86_64.whl (363.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 363.0/363.0 MB 1.2 MB/s eta 0:00:00 Collecting nvidia-cufft-cu12==11.2.0.44 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cufft_cu12-11.2.0.44-py3-none-manylinux2014_x86_64.whl (211.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 211.5/211.5 MB 1.8 MB/s eta 0:00:00 Collecting nvidia-curand-cu12==10.3.5.119 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_curand_cu12-10.3.5.119-py3-none-manylinux2014_x86_64.whl (56.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.3/56.3 MB 1.3 MB/s eta 0:00:00 Collecting nvidia-cusolver-cu12==11.6.0.99 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cusolver_cu12-11.6.0.99-py3-none-manylinux2014_x86_64.whl (128.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.4/128.4 MB 1.3 MB/s eta 0:00:00 Collecting nvidia-cusparse-cu12==12.3.0.142 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_cusparse_cu12-12.3.0.142-py3-none-manylinux2014_x86_64.whl (207.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 207.5/207.5 MB 1.6 MB/s eta 0:00:00 Collecting nvidia-nccl-cu12==2.20.5 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_nccl_cu12-2.20.5-py3-none-manylinux2014_x86_64.whl (176.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 176.2/176.2 MB 1.7 MB/s eta 0:00:00 Collecting nvidia-nvtx-cu12==12.4.99 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_nvtx_cu12-12.4.99-py3-none-manylinux2014_x86_64.whl (99 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.1/99.1 kB 2.8 MB/s eta 0:00:00 Collecting nvidia-nvjitlink-cu12==12.4.99 (from torch) Downloading https://download.pytorch.org/whl/cu124/nvidia_nvjitlink_cu12-12.4.99-py3-none-manylinux2014_x86_64.whl (21.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.1/21.1 MB 1.3 MB/s eta 0:00:00 Collecting triton==3.0.0 (from torch) Downloading https://download.pytorch.org/whl/triton-3.0.0-1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (209.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 209.5/209.5 MB 1.2 MB/s eta 0:00:00 Collecting numpy (from torchvision) Downloading https://download.pytorch.org/whl/numpy-1.26.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.0/18.0 MB 1.0 MB/s eta 0:00:00 Collecting pillow!=8.3.*,>=5.3.0 (from torchvision) Downloading https://download.pytorch.org/whl/pillow-10.2.0-cp312-cp312-manylinux_2_28_x86_64.whl (4.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 1.2 MB/s eta 0:00:00 Collecting MarkupSafe>=2.0 (from jinja2->torch) Downloading https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28 kB) Collecting mpmath>=0.19 (from sympy->torch) Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 1.2 MB/s eta 0:00:00 Installing collected packages: mpmath, typing-extensions, sympy, setuptools, pillow, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, numpy, networkx, MarkupSafe, fsspec, filelock, triton, nvidia-cusparse-cu12, nvidia-cudnn-cu12, jinja2, nvidia-cusolver-cu12, torch, torchvision, torchaudio Successfully installed MarkupSafe-2.1.5 filelock-3.13.1 fsspec-2024.2.0 jinja2-3.1.3 mpmath-1.3.0 networkx-3.2.1 numpy-1.26.3 nvidia-cublas-cu12-12.4.2.65 nvidia-cuda-cupti-cu12-12.4.99 nvidia-cuda-nvrtc-cu12-12.4.99 nvidia-cuda-runtime-cu12-12.4.99 nvidia-cudnn-cu12-9.1.0.70 nvidia-cufft-cu12-11.2.0.44 nvidia-curand-cu12-10.3.5.119 nvidia-cusolver-cu12-11.6.0.99 nvidia-cusparse-cu12-12.3.0.142 nvidia-nccl-cu12-2.20.5 nvidia-nvjitlink-cu12-12.4.99 nvidia-nvtx-cu12-12.4.99 pillow-10.2.0 setuptools-70.0.0 sympy-1.12 torch-2.4.1+cu124 torchaudio-2.4.1+cu124 torchvision-0.19.1+cu124 triton-3.0.0 typing-extensions-4.9.0 (zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$
Install tensorboard:
TensorBoard is TensorFlow’s visualization toolkit, and "provides the visualization and tooling needed for machine learning experimentation."
(zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ pip install tensorboard
Install torchviz:
TorchViz is a neat package that allows us to visualize a model’s structure.
zzh@ZZHPC:~$ dpkg --list | grep graphviz ii graphviz 2.42.2-6ubuntu0.1+esm1 amd64 rich set of graph drawing tools (zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ pip install torchviz
Install Jupyter:
(zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ pip install jupyterlab
Upgrade numpy:
(zpytorch) zzh@ZZHPC:~/zd/Github/zpytorch$ pip install --upgrade numpy
Delete the virtual environment after using:
(zpytorch) zzh@ZZHPC:/zdata/Github/zpytorch$ du -sh . 5.6G . (zpytorch) zzh@ZZHPC:/zdata/Github/zpytorch$ deactivate zzh@ZZHPC:/zdata/Github/zpytorch$ cd .. zzh@ZZHPC:/zdata/Github$ rm -rf zpytorch