Conda Commands

Commonly Used Anaconda Commands for Beginners

These are some basic and commonly used Conda commands that help beginners manage environments, Python versions, and packages easily.

1. Check Conda Version
conda --version

This shows the installed Conda version.

Example:

conda 24.1.2

2. Create New Conda Environment

conda create -n myenv python=3.10 -y

Explanation:

conda create   → creates environment
-n myenv → environment name
python=3.10 → Python version
-y → auto confirm installation

3. Activate Environment

conda activate myenv

This activates the environment.

Terminal will show:

(myenv)

4. Deactivate Environment

conda deactivate

This exits the current environment.

5. List All Environments

conda env list

or

conda info --envs

Example output:

base
myenv
skin-cancer-app

The active environment shows *.

6. Remove Environment

conda remove -n myenv --all

This deletes the complete environment.

Note: deactivate the current environemnt before removing

7. Install Package Using Conda

conda install numpy

Installs NumPy package.

8. Install Multiple Packages

conda install numpy pandas matplotlib

Installs multiple packages together.

9. Install Specific Package Version

conda install python=3.10

or

conda install numpy=1.26

10. Install PyTorch CPU Version

conda install pytorch torchvision cpuonly -c pytorch -y

Used for systems without NVIDIA GPU.

11. Install PyTorch GPU Version

conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia -y

Used for NVIDIA GPU systems.

12. Update All Packages

conda update --all

Updates all installed packages inside current environment.

13. Search Available Packages

conda search tensorflow

Searches available versions of TensorFlow.

14. Export Environment

conda env export > environment.yml

Exports complete environment configuration.

Useful for sharing projects.

15. Create Environment from File

conda env create -f environment.yml

Creates environment from exported file.

16. Install Packages Using pip

pip install fastapi

Some packages are installed using pip instead of Conda.

17. Install Packages from requirements.txt

pip install -r requirements.txt

Installs all packages listed in requirements.txt.

18. Export Installed pip Packages

pip freeze > requirements.txt

Creates requirements.txt file.

19. Check Installed Packages

pip list

or

conda list

Shows installed packages.

20. Check Python Version

python --version

Example:

Python 3.10.18

21. Run Python File

python main.py

Runs a Python script.

22. Run FastAPI Backend

python -m uvicorn main:app --reload

Starts FastAPI development server.

23. Navigate Between Folders

Move inside folder:

cd foldername

Move back one folder:

cd ..

24. Create Folder

mkdir backend

Creates new folder.

25. Create File (Windows)

type nul > main.py

Creates empty file.

26. Clear Terminal

Windows:

cls

Linux/Mac:

clear

27. Open Jupyter Notebook

jupyter notebook

Starts Jupyter Notebook server.

28. Open VS Code from Terminal

code .

Opens current folder in VS Code.

29. Verify GPU Availability in PyTorch

import torch
print(torch.cuda.is_available())

Returns:

True

if GPU is available.

Most Important Commands for Beginners

conda create -n myenv python=3.10 -y
conda activate myenv
pip install -r requirements.txt
conda install pytorch torchvision cpuonly -c pytorch -y
python main.py
python -m uvicorn main:app --reload
npm install
npm run dev

These commands are commonly used in most Deep Learning projects.

Previous Topic Project 3_1 Next Topic DL Projects