Thanks for mirrors.bfsu.edu.cn and aliyun.
ubuntu
Back up the source file:
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo touch /etc/apt/sources.list
sudo nano /etc/apt/sources.list
Then adding the follows to the new source file:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
Then check it:
sudo apt update
homebrew for macOS
Follow to https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
anaconda
Create the .condarc
file if it does not exist.
touch ~/.condarc
Then copy the following mirrors to the .condarc
:
channels:
- http://mirrors.bfsu.edu.cn/anaconda/pkgs/main
- http://mirrors.bfsu.edu.cn/anaconda/pkgs/free
- http://mirrors.bfsu.edu.cn/anaconda/pkgs/r
- http://mirrors.bfsu.edu.cn/anaconda/pkgs/pro
- http://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
show_channel_urls: true
custom_channels:
conda-forge: http://mirrors.bfsu.edu.cn/anaconda/cloud
msys2: http://mirrors.bfsu.edu.cn/anaconda/cloud
bioconda: http://mirrors.bfsu.edu.cn/anaconda/cloud
menpo: http://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch: http://mirrors.bfsu.edu.cn/anaconda/cloud
simpleitk: http://mirrors.bfsu.edu.cn/anaconda/cloud
intel: http://mirrors.bfsu.edu.cn/anaconda/cloud
Then clean the cache and test it:
conda update --strict-channel-priority --all
conda clean -i
conda create -n ts python==3.8.10
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=11.1 -c pytorch -c conda-forge
pip
Update the pip program to the latest.
pip install -i https://pypi.bfsu.edu.cn/simple pip -U
and then, change the mirror:
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple/
or
pip config set global.index-url https://mirrors.hust.edu.cn/pypi/web/simple
or using tencent: nano ~/.pip/pip.conf
, and paste the following:
[global]
index-url = https://mirrors.cloud.tencent.com/pypi/simple/
[install]
trusted-host=mirrors.cloud.tencent.com
timeout = 120
Transfer the conda env to another machine.
- Backup the conda packages
conda list --explicit > packages.txt
- Backup the pip packages and Upload the packages.txt and requirements.txt to the target machine
pip list --format=freeze > requirements.txt
- Install the packages with conda on a new machine
conda create --name env_name --file packages.txt
- Install the pip in the new env
conda activate env_name
conda install pip
- Install the remaining packages with pip in the new env
pip install -r requirements.txt