Python Conda
conda is similar to venv.
conda create --name myenv
conda activate myenv
conda install --file requirements.txtImportant often i.e if you are using someone else’s code, you have to specify in “create” and a .yml file like his:
conda env create -f requirements.ymlWhen using both conda and pip, the best practice is to follow this order:
- Conda first
conda install <package> - If conda doesn’t find a package then
pip install <package>
To get the latest versions of most data science tools, add the conda-forge channel:
conda config --add channels conda-forge
conda config --set channel_priority strictPrevious solves the error PackagesNotFoundError for packages like absl-py.
Using Conda with Google Colab: a version of conda can also be activate in Google Colab
!pip install -q condacolab
import condacolab
condacolab.install()
# Use python 3.10 without environment.yml
!mamba install python=3.10 -c conda-forge --yes
# Or with environment.yml
!mamba env update -n base -f environment.ymlWhen using the google colab version, you are restricted to use (and update) che base environment called “base”.
Conda in VSCodium:
Control + Shift + P>Select Environment> select conda