Ved Prakash Pathak
Ved Prakash Pathak

Reputation: 21

"Jupyter Failed to Open in Anaconda: Module Not Found Error"

Traceback (most recent call last): File "C:\Users\vpved.conda\envs\Ved\Scripts\jupyter-notebook-script.py", line 6, in from notebook.notebookapp import main ModuleNotFoundError: No module named 'notebook.notebookapp'

image

Reinstalled Anaconda to ensure a clean installation. Tried multiple commands in the Anaconda Prompt, including:

conda install jupyter
conda install jupyter-notebook
conda upgrade "ipython[all]"

However, none of these attempts have resolved the problem. Jupyter Notebook remains inaccessible, hindering my workflow and productivity.

Upvotes: 2

Views: 2156

Answers (2)

Ayaj Shaikh
Ayaj Shaikh

Reputation: 31

NoModuleFoundError: notebook. notebookapp

It is because you imported the notebookapp module from the wrong folder, the notebookapp module you are trying to use is not in the notebook folder.

Go to the file location where the jupyter-notebook-script.py and open it in VS code. Now run this file and check the same error you occurred when trying to open the Jupyter Notebook from the cmd prompt or anything.

If the same error occurs then go to this file location C:\ProgramData\anaconda3 and search the { notebookapp } python now to go to the file location by clicking the left click on that file and you will get the option that is open file location now click on that.

You will directed to the location of that file. Now the most important, find out the folder in which this ( notebookapp ) file is stored.

In my case, it was found in the nbclassic folder.

Open the file/script jupyter-notebook-script.py in vs code or any IDE and change the code like below. notebook changes to nbclassic

Before updating


import re
import sys

from notebook.notebookapp import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

After Updating


import re
import sys

from nbclassic.notebookapp import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

Change the code like that in my case it is found in the nbclassic folder thats why I am importing from that.

from nbclassic.notebookapp import main

This will work if you have the same error.

Upvotes: 3

ad ad
ad ad

Reputation: 1

I had the same issue after updating all (pip list --outdated) and the jupyter doesnt opened.. I uninstall anaconda and remove manually files from the Roaming and from Local... then install anaconda again and it works.

Upvotes: 0

Related Questions