[PYTHON] Error running Jupyter Notebook in Anaconda virtual environment

I had a problem trying to run Jupyter Notebook in Anaconda's virtual environment, so I will write down the remedy I took.

environment

--Windows10 64bit Home version 20H2

From creating a virtual environment to installing Jupyter Notebook

There is a lot of information on the web, but I found this to be the easiest I've tried.

First, create a virtual environment.

$ conda create -n environment name python=Version library name

Enter the created virtual environment.

$conda activate environment name

Install Jupyter Notebook in a virtual environment. (Not required if you specified "jupyter" as the library name when creating the virtual environment and installed it together.)

$ conda install jupyter

Set the Jupyter Notebook kernel to display the created virtual environment.

$ ipython kernel install --user --name=Environment name

Error occurred

In this state, you can start Jupyter Notebook in the virtual environment with the following command.

$ jupyter notebook

But when I write Python code, it doesn't run. Jupyter tried to connect to the kernel many times and got an error. It seems that the DLL has failed to load because the following message appears.

 File "C:\Users\User name\anaconda3\envs\Environment name\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed while importing error:The specified module cannot be found.

Error remedy

After searching around for a solution, I came up with the following information:

What to do when Anaconda's virtual environment is not recognized by jupyter or an error occurs

I will quote the command as it is, but I was able to solve it by executing this command in the virtual environment even in my own environment!

$conda uninstall pyzmq

$conda install pyzmq

$conda install jupyter

Note: Kernel removal

The method to remove the kernel of the virtual environment added to Jupyter is as follows.

$jupyter kernelspec uninstall environment name

Recommended Posts

Error running Jupyter Notebook in Anaconda virtual environment
Multiprocessing error in Jupyter Notebook
Error "Entry point not found" when starting Jupyter Notebook in virtual environment
Reflect the virtual environment created with Miniconda in Jupyter notebook
Creating a virtual environment in an Anaconda environment
Jupyter Notebook 6.0.2 cannot be installed in the Python 2.7 environment created in Anaconda
Browser specification of Jupyter Notebook in Windows environment
virtual environment in python
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Create an Anaconda virtual environment in your project folder
Command line collection for using virtual environment in Anaconda
Use Anaconda in pyenv environment
Display HTML in Jupyter notebook
Build an Anaconda virtual environment
homebrew, pyenv, anaconda, Jupyter Notebook
[Anaconda] Activate the virtual environment
Switch virtual environment with jupyter
python3.8 venv environment jupyter notebook
Seaborn, matplotlib garbled characters resolved in Windows10, Anaconda virtual environment
Machine learning with Jupyter Notebook in OCI Always Free environment (2019/12/17)
I want to use a virtual environment with jupyter notebook!
How to build Anaconda virtual environment used in Azure Machine Learning and link with Jupyter
[Note] Running a virtual environment on Jupyter Notebook [ImportError: There is no module called win32api]
Python memo Anaconda x Jupyter Notebook
Install scrapy in python anaconda environment
Generate Jupyter notebook ".ipynb" in Python
Various Anaconda settings in Windows 10 environment
install tensorflow in anaconda + python3.5 environment
[MEMO] [Development environment construction] Jupyter Notebook
View graphs inline in Jupyter Notebook
Fix setuptools missing error in anaconda
Created an environment for Anaconda & Jupyter
Try running Jupyter Notebook on Mac
Learn machine learning anytime, anywhere in an on-demand Jupyter Notebook environment
Install Django in a pipenv virtual environment
I wanted to use jupyter notebook with docker in pip environment (opticspy)
[5 steps] Apply anaconda virtual environment to VScode
[Python] Create a virtual environment with Anaconda
How to execute commands in jupyter notebook
[Django] sqlite version error when running python manage.py in aws cloud9 environment
I started Node.js in a virtual environment
How to deal with "No module named'〇〇'" error in Jupyter Notebook | Install with! Pip!
Build a PYNQ environment on Ultra96 V2 and log in to Jupyter Notebook
Call anaconda virtual environment from ubuntu terminal memorandum
Run PIFuHD in Windows + Anaconda + Git Bash environment
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Ubuntu18.04.05 Creating a python virtual environment in LTS
Start Django in a virtual environment with Pipenv
Create a virtual environment with conda in Python
[Memo] Build a virtual environment with Pyenv + anaconda
Error when entering virtual environment with workon command
[Node-RED] Execute Python on Anaconda virtual environment from Node-RED [Anaconda] [Python]
Work in a virtual environment with Python virtualenv.
Coexistence of Anaconda 2 and Anaconda 3 in Jupyter + Bonus (Julia)
Use jupyter-lab installed in python virtual environment (venv)
Could not import C error in GO environment
Use Python in Anaconda environment with VS Code
(Bottom) Cooperation between Jupyter Notebook and running Excel
Use anaconda virtual environment with Zsh (problem fix)
Jupyter installation error
Python 3.3 in Anaconda