Conda
Conda base
Section titled “Conda base”checking Conda disk usage if you had space issues
du -hs ~/.conda
Ipykernel in Conda and Jupyeter Notebooks
Section titled “Ipykernel in Conda and Jupyeter Notebooks”Adding ipykernel to conda env
Section titled “Adding ipykernel to conda env”Installing dependencies inside your Conda env
conda install anaconda::jupyter
conda install nb_conda
conda install ipykernel
python -m ipykernel install --user --name mykernel
Installing ipykernel in your conda env with a custom name(recommended for clarity)
#change myenv to whatever you named the environment
python -m ipykernel install --user --name myenv --display-name “python (myenv)”
#for example, your conda env is called tfmain, and python is 3.10, then you can do:
python -m ipykernel install --user --name tfmain --display-name “python 3.10 (tfmain)”
venv as a more stable alternative
Section titled “venv as a more stable alternative”venv can be much more stable than conda if you want to use pip only packages (Mixing pip and conda can cause issues).
Section titled “venv can be much more stable than conda if you want to use pip only packages (Mixing pip and conda can cause issues).”if you aboslutely need to use some Conda packages, you need to have a specific order, using Conda packages first, and then pip packages. Otherwise, use pip with venv as the following:
Creating a virtual environment with venv
#create venv:
python3 -m venv envname
source envname/bin/activate # or whatever you named it
#Find all envs :
find ~ -type d -name "bin" -exec test -e "{}/activate" \; -print
#activate your env, assuming it's named ml-env here:
source ml-env/bin/activate
Removing ipykernel from conda env
Section titled “Removing ipykernel from conda env”Removing unused ipykernels to avoid confusion
#lists all ipykernels
jupyter kernelspec list
#uninstall kernel, replace unwanted-kernel with the name of the kernel you want to remove
jupyter kernelspec uninstall unwanted-kernel
Common errors
Section titled “Common errors”Charset normalizer error
jupyter AttributeError: partially initialized module ‘charset_normalizer’ has no attribute ‘md__mypyc’ (most likely due to a circular import)
Charset normalizer error fix
pip install -U --force-reinstall charset-normalizer
Read more in the Stackoverflow.