How to Install Conda and Miniconda3 on Ubuntu 22.04 LTS

How to Install Conda and Miniconda3 on Ubuntu 22.04

This morning I find myself working on a new data mining project that relies on Conda. I ran into a few issues along the way and decided to write this up. My pain is your gain!

$python3 --version
Python 3.10.6

Next I visited https://docs.conda.io/en/latest/miniconda.html#linux-installers to find the correct installer for my version of Python

Ubuntu 22.04 LTS Conda Installer for Python 3.10
Ubuntu 22.04 LTS Conda Installer

X

$wget https://repo.anaconda.com/miniconda/Miniconda3-py310_22.11.1-1-Linux-x86_64.sh

X

$sudo chmod +x Miniconda3-py310_22.11.1-1-Linux-x86_64.sh

I was initially running the installer using Shell and continued to get the following error.

Installing * environment...
./Miniconda3-py310_22.11.1-1-Linux-x86_64.sh: 444: [[: not found
CondaFileIOError: '/home/ubuntu/miniconda3/pkgs/envs/*/env.txt'. [Errno 2] No such file or directory: '/home/ubuntu/miniconda3/pkgs/envs/*/env.txt'

After doing some research I found that my issue was due to running the installer with Shell instead of Bash.

$bash Miniconda3-py310_22.11.1-1-Linux-x86_64.sh

And Bob’s Your Uncle! We have a successful installation.

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
no change     /home/ubuntu/miniconda3/condabin/conda
no change     /home/ubuntu/miniconda3/bin/conda
no change     /home/ubuntu/miniconda3/bin/conda-env
no change     /home/ubuntu/miniconda3/bin/activate
no change     /home/ubuntu/miniconda3/bin/deactivate
no change     /home/ubuntu/miniconda3/etc/profile.d/conda.sh
no change     /home/ubuntu/miniconda3/etc/fish/conf.d/conda.fish
no change     /home/ubuntu/miniconda3/shell/condabin/Conda.psm1
no change     /home/ubuntu/miniconda3/shell/condabin/conda-hook.ps1
no change     /home/ubuntu/miniconda3/lib/python3.10/site-packages/xontrib/conda.xsh
no change     /home/ubuntu/miniconda3/etc/profile.d/conda.csh
modified      /home/ubuntu/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
   set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Miniconda3!

Now we need to modify our PATH in order for Miniconda3 to work.

$export PATH=/home/ubuntu/miniconda3/bin/:$PATH

Now we’ve got Conda and Miniconda3 installed on Ubuntu 22.04 LTS. Have an amazing day!

Related Posts