
Today I faced one error in Jupyter Notebook saying “500 : Internal Server Error“. I spent lots of time to solve this error. But trust me you will be shocked to see that how simple the solution is.
Error Details
Today I created a fresh conda virtual environment for Python 3.8 using below command:
conda create -n cv python=3.8
Now when I ran the command (jupyter notebook
) to open Jupyter Notebook. I found an error saying “500 : Internal Server Error” in the browser. Below is the screenshot.

You can also see my error log in the cmd below.
C:\Users\Anindya>activate cv
C:\Users\Anindya>conda.bat activate cv
(cv) C:\Users\Anindya>jupyter notebook
[I 12:04:56.745 NotebookApp] [nb_conda_kernels] enabled, 3 kernels found
_ _ _ _
| | | |_ __ __| |__ _| |_ ___
| |_| | '_ \/ _` / _` | _/ -_)
\___/| .__/\__,_\__,_|\__\___|
|_|
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.
https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html
Please note that updating to Notebook 7 might break some of your extensions.
[W 12:04:58.092 NotebookApp] Error loading server extension jupyterlab
Traceback (most recent call last):
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\requests\compat.py", line 11, in <module>
import chardet
ModuleNotFoundError: No module named 'chardet'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\notebookapp.py", line 2047, in init_server_extensions
mod = importlib.import_module(modulename)
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jupyterlab\__init__.py", line 7, in <module>
from .handlers.announcements import ( # noqa
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jupyterlab\handlers\announcements.py", line 15, in <module>
from jupyterlab_server.translation_utils import translator
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jupyterlab_server\__init__.py", line 5, in <module>
from .app import LabServerApp
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jupyterlab_server\app.py", line 10, in <module>
from .handlers import LabConfig, add_handlers
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jupyterlab_server\handlers.py", line 18, in <module>
from .listings_handler import ListingsHandler, fetch_listings
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jupyterlab_server\listings_handler.py", line 8, in <module>
import requests
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\requests\__init__.py", line 45, in <module>
from .exceptions import RequestsDependencyWarning
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\requests\exceptions.py", line 9, in <module>
from .compat import JSONDecodeError as CompatJSONDecodeError
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\requests\compat.py", line 13, in <module>
import charset_normalizer as chardet
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\charset_normalizer\__init__.py", line 23, in <module>
from charset_normalizer.api import from_fp, from_path, from_bytes, normalize
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\charset_normalizer\api.py", line 10, in <module>
from charset_normalizer.md import mess_ratio
File "charset_normalizer\md.py", line 5, in <module>
from charset_normalizer.utils import is_punctuation, is_symbol, unicode_range, is_accentuated, is_latin, \
ImportError: cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant' (C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\charset_normalizer\constant.py)
[I 12:04:58.215 NotebookApp] [nb_conda] enabled
[I 12:04:58.217 NotebookApp] Serving notebooks from local directory: C:\Users\Anindya
[I 12:04:58.218 NotebookApp] Jupyter Notebook 6.5.4 is running at:
[I 12:04:58.218 NotebookApp] http://localhost:8888/?token=7899462d310f80a2da7bfb168050060653cf58c494cfda8f
[I 12:04:58.218 NotebookApp] or http://127.0.0.1:8888/?token=7899462d310f80a2da7bfb168050060653cf58c494cfda8f
[I 12:04:58.219 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:04:58.264 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/Anindya/AppData/Roaming/jupyter/runtime/nbserver-30092-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=7899462d310f80a2da7bfb168050060653cf58c494cfda8f
or http://127.0.0.1:8888/?token=7899462d310f80a2da7bfb168050060653cf58c494cfda8f
[I 12:05:18.339 NotebookApp] Creating new notebook in
[E 12:05:18.511 NotebookApp] Uncaught exception GET /notebooks/Untitled.ipynb?kernel_name=conda-env-cv-py (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled.ipynb?kernel_name=conda-env-cv-py', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\dammit.py", line 28, in <module>
import cchardet as chardet_module
ModuleNotFoundError: No module named 'cchardet'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\dammit.py", line 33, in <module>
import chardet as chardet_module
ModuleNotFoundError: No module named 'chardet'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\tornado\web.py", line 1786, in _execute
result = await result
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\tornado\gen.py", line 786, in run
yielded = self.gen.send(value)
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\notebook\handlers.py", line 94, in get
self.write(self.render_template('notebook.html',
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\base\handlers.py", line 515, in render_template
return template.render(**ns)
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jinja2\environment.py", line 1301, in render
self.environment.handle_exception()
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\jinja2\environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\templates\notebook.html", line 1, in top-level template code
{% extends "page.html" %}
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\templates\page.html", line 187, in top-level template code
{% block header %}
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\templates\notebook.html", line 115, in block 'header'
{% for exporter in get_frontend_exporters() %}
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\notebook\notebook\handlers.py", line 23, in get_frontend_exporters
from nbconvert.exporters.base import get_export_names, get_exporter
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\nbconvert\__init__.py", line 3, in <module>
from . import filters, postprocessors, preprocessors, writers
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\nbconvert\filters\__init__.py", line 8, in <module>
from .markdown import *
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\nbconvert\filters\markdown.py", line 13, in <module>
from .markdown_mistune import markdown2html_mistune
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\nbconvert\filters\markdown_mistune.py", line 23, in <module>
import bs4
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\__init__.py", line 37, in <module>
from .builder import (
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\builder\__init__.py", line 9, in <module>
from bs4.element import (
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\element.py", line 13, in <module>
from bs4.formatter import (
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\formatter.py", line 1, in <module>
from bs4.dammit import EntitySubstitution
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\bs4\dammit.py", line 37, in <module>
import charset_normalizer as chardet_module
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\charset_normalizer\__init__.py", line 23, in <module>
from charset_normalizer.api import from_fp, from_path, from_bytes, normalize
File "C:\Users\Anindya\AppData\Local\anaconda3\envs\cv\lib\site-packages\charset_normalizer\api.py", line 10, in <module>
from charset_normalizer.md import mess_ratio
AttributeError: partially initialized module 'charset_normalizer' has no attribute 'md__mypyc' (most likely due to a circular import)
[E 12:05:18.549 NotebookApp] {
"Host": "localhost:8888",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Referer": "http://localhost:8888/tree",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.183"
}
[E 12:05:18.549 NotebookApp] 500 GET /notebooks/Untitled.ipynb?kernel_name=conda-env-cv-py (::1) 138.520000ms referer=http://localhost:8888/tree
Solution
The solution of this error is simple. I wasted lots of time to find this silly error. You will see lots of solutions over the Internet. But trust me none of them will solve this 500 : Internal Server Error.
To solve this error you just need to observe your cmd log. As you can see in my log I have an error saying: ModuleNotFoundError: No module named 'chardet'
.
So you just need to install that library using below command:
conda install chardet
I am using Anaconda so I installed that library using conda
command. If you do not use Anaconda then you can use pip
command to install that Python package.
That’s it. 500 : Internal Server Error in Jupyter Notebook should go now and it should open correctly in your web browser.
Please note that I had issue with chardet
module so I installed that library You may get another library error say: tornado. In that case, you need to install that library.
Other Solution
In case you do not see any library related issue in your cmd log then this 500 : Internal Server Error might be because of nbconvert
package.
In this case, you just need to upgrade this package to solve 500 : Internal Server Error. Below is the command to upgrade this Python library:
pip install --upgrade nbconvert
or
conda upgrade nbconvert
After installing or upgrading nbconvert
library your error should resolve. Still, if you are getting same error, let me know in the comment section below, and I will try to find another best solution.

Hi there, I’m Anindya Naskar, Data Science Engineer. I created this website to show you what I believe is the best possible way to get your start in the field of Data Science.
thx man