Sitemap

Conda on Linux CLI

3 min readSep 27, 2023

--

Anaconda provides a simplified way of dealing with different packages, different python versions, while keeping everything tidy on same machine.

Dockers are good for development, that also allows to run different programs on same machine, but there is a lot of hassle in just creating Dockerfile and mounting drives. Not just that sometimes while you expect the training to be working perfectly — it gets crashed while you were sleeping — due to shm memory limitations.
(If you need to install Docker — I have written the steps here https://medium.com/@vermavinay982/how-to-install-docker-c63135dd8dbc)

Back to conda now, they are much more easy and straightforward — multiple users can have different conda setup in their linux machines. Without affecting each other’s packages.

Anaconda — is a heavy package containing all required common libraries, all packed into one installation. But as I mentioned “heavy” xD.
For our use case, most of the times we dont need all libraries — we need a fresh clean installation without any package. And also less storage to be used. There comes miniconda to the rescue.
As the name suggests — it is mini version of Anaconda.

To install on your Linux/Windows machine you have to go to this list of installations available and choose for your architecture. It feels scary, but trust me, its very simple.

https://repo.anaconda.com/miniconda/

For windows, you can download the .exe file — and navigate through the GUI. Then need to setup environment variables — and you are done.
For Linux, again you can download .sh files — run the .sh using bash and in the CLI itself, check all options accept terms — and you are done

Get Vinay Kumar Verma’s stories in your inbox

Join Medium for free to get updates from this writer.

In case, you are avoiding the hassle to download .sh file — and then move to your linux machine — you can directly use ‘wget’ utility for easy downloading. Make sure you have selected the correct link from miniconda repository URL.

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

Thats it, you will have to initialise the conda for your shell, and you will be ready to work with it.

Press enter or click to view image in full size
Photo by Farzad on Unsplash

Windows
After installing on windows, you have to add the miniconda paths into your system environment files — reason is to allow all files in miniconda folder to be accessible all over your system. Else you wont be able to access python or conda commands anywhere on your pc, you need to go to the folder where it is installed. (which is not practical)

D:\softwares\miniconda3\Scripts — for conda commands
D:\softwares\miniconda3 — for python commands

Bonus

Exporting and Importing Conda Env — this will allow to export all libraries you were having in conda env, and install the same everytime you create a new conda environment.

# activate required environment
conda activate torchenv

# conda export environment.yml
conda env export > my_environment.yml

# conda create environment from file (Same environment name)
conda env create -f my_environment.yml

Thats it, will add more — in this blog post only — this one is for my personal reference. Coz who has enough time to remember all these commands by heart — we developers have a lot more other tasks to remember :)
Hope it helps, Do press clap button :P — it motivates to write more here
All the best.

--

--

Vinay Kumar Verma
Vinay Kumar Verma

Written by Vinay Kumar Verma

Sr Computer Vision Engineer | Using AI to Reduce if-else