Creating virtual environment
To create a virtual enviroment with conda:
conda create -n venv pip
This will create a virtual env called venv and install pip in that env. It is reccommended that you install packages while creating the virtual env. So if you want to install torch and matplotlib, this is how your command will look like.
conda create -n venv pip torch matplotlib
To install particular versions of packages:
conda create -n venv scipy=0.17.3 astroid babel
To activate the virtual environment:
conda activate venv
To deactivate the virtual env:
conda deactivate
The default python used for creating the virtual env is python 3.12 or whatever is the latest. To choose a specific python version:
conda create -n venv399 python=3.9.9
You might want to specify the channel in which this version is available for installation. So:
conda create -n venv399 python=3.9.9 -c conda-forge
To make an exact copy of a virutal env
conda create --name venv-clone --clone venv
To list envs:
conda info --envs
To see the packages installed in an active env:
conda list
To connect jupyter notebook to conda env:
- Go into the virtual env:
conda activate venv conda install ipykernelipython kernel install --user --name=<any_name_for_kernel>jupyter notebook
Install miniconda
From here
mkdir -p ~/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
Then run the following commands:
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.