Sunforger

Sunforger

Linux Server Miniconda Installation

Download the installation script from Tsinghua source https://mirror.tuna.tsinghua.edu.cn/anaconda/miniconda/

Note to distinguish between versions and system architectures. You can run the command below to check

uname -m

Installation#

Run the script and follow the prompts to install

bash M

Default Installation Path and Modification#

The system's default installation path is /home/your_username/miniconda3, which can be modified during the installation prompts.

Assuming the installation path is changed to: /home/your_username/software/miniconda3

Just follow the prompts to install.

Manual Initialization#

After installation, please restart the shell to make the configuration effective.

If miniconda does not start normally, you may consider manual initialization.

Manual Initialization Method: Run the built-in activation script

source /home/your_username/software/miniconda3/bin/activate
conda init

The effect of the above operation is to automatically append the following content to the /home/your_username/.bashrc file:
This is consistent with the description in the anaconda documentation, see https://docs.anaconda.com/anaconda/install/linux/

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/your_username/software/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/your_username/software/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/home/your_username/software/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/your_username/software/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

After activation, the shell interface will display the current environment at the beginning of the line, which is

(base) your_username@host_name: ~$

This completes the installation, and you can then use conda -V to verify the installation effect.

Change Source#

Use Tsinghua source. For configuration methods, refer to the documentation https://mirror.tuna.tsinghua.edu.cn/help/anaconda/

Since changing the source requires modifying the /home/your_username/.condarc file, and by default, the .condarc file will not be created during installation. You can run the following command to automatically or manually create the .condarc file.

conda config
# or
touch .condarc

Then, copy and paste the content from the Tsinghua source documentation

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

Update the cache using

conda clean -i
conda create -n myenv numpy

Configure pip to change the source
Refer to the Tsinghua source documentation https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.