Search code examples
python-3.xjupyter-notebookpipcondaubuntu-22.04

500 : Internal Server Error In Ubuntu22.04


I'm new to linux. I want to use jupyter notebook in Ubuntu22.04.I have managed to download and install (using condaconda install jupyter notebook, when I using pip install notebook, I have an errorERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/pickleshare-0.7.5.dist-info/METADATA), and I'm having trouble opening ".ipynb",I try upgrading jupyter hub by

pip install --upgrade
pip install --upgrade nbconvert

But that doesn't work.

Here are The full error messages in my terminal

Uncaught exception GET /notebooks/notebooks/manuscript.ipynb (xxx.x.x.x)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/notebooks/manuscript.ipynb', version='HTTP/1.1', remote_ip='xxx.x.x.x')
    Traceback (most recent call last):
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/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 "/home/master/anaconda3/envs/FWI/lib/python3.9/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 "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/tornado/web.py", line 1713, in _execute
        result = await result
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/tornado/gen.py", line 782, in run
        yielded = self.gen.send(value)
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 94, in get
        self.write(self.render_template('notebook.html',
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/notebook/base/handlers.py", line 511, in render_template
        return template.render(**ns)
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
        self.environment.handle_exception()
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
        raise rewrite_traceback_stack(source=source)
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/notebook/templates/page.html", line 166, in top-level template code
        {% block header %}
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/notebook/templates/notebook.html", line 115, in block 'header'
        {% for exporter in get_frontend_exporters() %}
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 23, in get_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
      File "/home/master/.local/lib/python3.9/site-packages/nbconvert/__init__.py", line 6, in <module>
        from . import filters, postprocessors, preprocessors, writers
      File "/home/master/.local/lib/python3.9/site-packages/nbconvert/filters/__init__.py", line 8, in <module>
        from .markdown import *
      File "/home/master/.local/lib/python3.9/site-packages/nbconvert/filters/markdown.py", line 13, in <module>
        from .markdown_mistune import markdown2html_mistune
      File "/home/master/.local/lib/python3.9/site-packages/nbconvert/filters/markdown_mistune.py", line 16, in <module>
        import bs4
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/bs4/__init__.py", line 37, in <module>
        from .builder import (
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/bs4/builder/__init__.py", line 9, in <module>
        from bs4.element import (
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/bs4/element.py", line 19, in <module>
        from bs4.formatter import (
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/bs4/formatter.py", line 1, in <module>
        from bs4.dammit import EntitySubstitution
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/bs4/dammit.py", line 37, in <module>
        import charset_normalizer as chardet_module
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/site-packages/charset_normalizer/__init__.py", line 23, in <module>
        from charset_normalizer.api import from_fp, from_path, from_bytes, normalize
      File "/home/master/anaconda3/envs/FWI/lib/python3.9/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 17:02:17.804 NotebookApp] {
      "Host": "localhost:8888",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
      "Referer": "http://localhost:8888/tree/notebooks",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"

I find my error is different from others.I'm confused by this error,so please help me, thank you very much.

AttributeError: partially initialized module 'charset_normalizer' has no attribute 'md__mypyc' (most likely due to a circular import)

Solution

  • Does your Jupiter Notebook work?

    Your error just states that there is a mistake in your code:

    import cchardet as chardet_module
    

    The module cchardet was not found. You could fix this by installing it with:

    pip install cchardet
    

    Add this line at the start of your program in a cell and execute it. Then it should work.