Home Systems & Containers How to Install and Set Up Miniconda on Linux (Ubuntu)

How to Install and Set Up Miniconda on Linux (Ubuntu)

317
0

If you’re starting with Python and want a lightweight way to manage packages and environments, Miniconda is a great choice. It provides Conda, a powerful tool for creating isolated environments and managing Python packages, without all the extras included in Anaconda.

This guide walks you step-by-step through installing and setting up Miniconda on Ubuntu, using the terminal installer. We’ll also cover how to install Jupyter Notebook for interactive coding.


1. Download Miniconda

Option A – With wget (recommended for servers and desktops)

Open a terminal (Ctrl+Alt+T) and download the latest installer:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

This URL always points to the latest stable release.

Option B – With curl

If you prefer curl:

curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

2. Install Miniconda

Make the installer executable:

chmod +x Miniconda3-latest-Linux-x86_64.sh

Run it:

bash Miniconda3-latest-Linux-x86_64.sh

Follow the prompts:

  • Press Enter to continue
  • Review and accept the license terms (yes)
  • Choose an install location (default: ~/miniconda3)

3. Initialize Conda

At the end of installation, you’ll be asked whether you want to initialize Conda:

✔ Recommended: say yes. This updates your shell startup file (~/.bashrc on Ubuntu by default) so Conda works in every new terminal session.
❌ Skip if you want manual control (you can run conda init later).

If you skipped earlier, run:

conda init bash

Restart your terminal. You should see (base) in your prompt, showing that the base Conda environment is active.

Check Conda’s version to confirm installation:

conda --version

4. Create and Manage Environments

Create a new environment with Python 3.11:

conda create -n myenv python=3.11

Activate it:

conda activate myenv

Install packages inside the environment:

conda install numpy pandas

Deactivate when done:

conda deactivate

5. Install Jupyter Notebook

With Conda ready, you can easily install Jupyter Notebook:

conda install jupyter notebook

Launch it:

jupyter notebook

A browser window will open. Click New → Python 3 to start a notebook.

Try running:

print("Hello, world!")

6. Troubleshooting

  • conda: command not found → Run conda init bash and restart your terminal.
  • Multiple Python installs → Keep Conda separate; avoid mixing with system Python.
  • Reinstall from scratch → Delete ~/miniconda3 and reinstall.

🎯 Final Notes

  • Beginners: Terminal install is straightforward and works everywhere.
  • Advanced users: You can automate installation with scripts — useful for servers.
  • Always create separate Conda environments for each project.
  • Jupyter Notebook integrates seamlessly with Conda environments — just activate the one you need before launching.

📌 Notes for Other Distros

  • Fedora, CentOS, RHEL: The steps are identical, but Conda usually initializes in ~/.bashrc or ~/.bash_profile.
  • Arch Linux / Manjaro: Same installation process, but users often prefer zsh → run conda init zsh instead.
  • WSL (Ubuntu on Windows): Works the same as native Ubuntu. Make sure Windows firewall allows Jupyter Notebook to open in your browser.
Previous articleHow to Install and Set Up Miniconda on macOS
Next articleGetting Started with Jupyter Notebooks
Heartin Kanikathottu
As a seasoned Cloud and Security Architect, I’ve led transformative initiatives in key roles, including Vice President at Morgan Stanley, Principal Architect at Societe Generale, and Tech Lead & Cloud Security Architect at VMware, among others. I’m also an internationally published author with multiple books available on platforms like Amazon and O'Reilly. Notably, one of my books was recognized as the 8th best cloud computing book of all time in 2020, reflecting the impact of my contributions to the field. With over 15 professional certifications from providers such as Microsoft (Azure), Amazon (AWS), Oracle (Java), Pivotal (Spring), and IBM, I bring a wealth of expertise to my work. Academically, I hold dual Master’s degrees in Cloud Computing and Data Analytics. I’m passionate about sharing knowledge and mentoring others, which is why I actively speak at global technical forums such as Tech Opportunities Fest at Platform Calgary, Google's Kubernetes Meetup, Java User Group, Elasticsearch Meetup, and the Agile India Conference.

LEAVE A REPLY

Please enter your comment!
Please enter your name here