How to set up jupyter in a conda environment?

2023-10-31

I found a new book, Dive into Deep Learning, to learn deep learning. However, I followed the tutorial of installation. At first everything was fine, but when I started to run the example in jupyter webpage, which showed the no found module error. I checked the error message and found the it uses my system python as kernel instead of the python on my activation environment. So I asked ChatGPT and found the solution.

  • Activate your conda environment by running the following command in your terminal: conda activate <environment_name>

  • Install the ipykernel package in your conda environment by running the following command: conda install ipykernel

  • Register the conda environment as a Jupyter kernel by running the following command: python -m ipykernel install --user --name=<environment_name>

  • Start Jupyter Notebook by running the following command:jupyter notebook

  • In Jupyter Notebook, click on "New" and you should see your conda environment listed as an available kernel.

By following these steps, you should be able to use Jupyter Notebook with the Python kernel from your conda environment.