Install Miniconda on Server
Published:
Step 1: Download Miniconda Locally
Run the following command to download the latest Miniconda installer for Linux (adjust the link if using macOS):
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
Step 2: Install Miniconda Locally
Run the installation script:
bash ~/miniconda.sh -b -p ~/miniconda
-b
→ Run in batch mode (no prompts).-p ~/miniconda
→ Install it in your home directory (~/miniconda
).
Step 3: Initialize Miniconda
Activate the installed Miniconda:
~/miniconda/bin/conda init
To activate the installation manually, add this to your ~/.bashrc
or ~/.bash_profile
:
export PATH="$HOME/miniconda/bin:$PATH"
Then, apply the changes:
source ~/.bashrc
Step 4: Create a Virtual Environment
Once Miniconda is installed, create a virtual environment:
conda create --prefix ~/myenv python=3.10 -y
Activate the environment:
conda activate ~/myenv
To deactivate the environment:
conda deactivate
Additional Notes:
- If you don’t want to modify
~/.bashrc
, you can manually activate Miniconda each session with:export PATH="$HOME/miniconda/bin:$PATH"
- If
conda activate ~/myenv
doesn’t work, try:source activate ~/myenv
This setup ensures Miniconda and virtual environments remain local without interfering with the system-wide installation. 🚀