Jupyter notebook error: "bad file descriptor" error and debugger warnings related to frozen modules


I just install anaconda for my computer science course but something is wrong when I run the jupyter notebook. And also the code I typed can’t be runned by Python 3 (ipykernel). I am totally new to these things. Could somebody help me with this?

Please read Getting good answers to your questions and use it as a guide for future posts.

Mostly what you post about in the screenshot is just a warning, not an error. These are very distinct concepts. Much of that is covered here if you search with ‘frozen modules’ on this forum.

The part about “And also the code I typed can’t be runned by Python 3 (ipykernel)” is more troubling then the warning. However, you don’t share much about this. Along this line…
How are you starting Jupyter? Because you are using the Anaconda Distribution, you should ideally be starting up the Anaconda Navigator and using that to launch Jupyter that Anaconda installed.
I suspect things not working when you try to execute code is due to your system being messed up with competing Python, or you are starting things wrong (see above), as evidenced by seeing Jupyter linked to AppData and not seeing Anaconda. But maybe it was above the tiny portion of what you shared in your screenshot? (This is a big part of why screenshots are strongly discouraged. Just copy and paste the COMPLETE text code.) For example, when I start up on my Mac, I see something like this:

/Users/wayne/anaconda3/bin/jupyter_mac.command ; exit;                          
(base) wayne@SLab-MacBook-Pro2019 ~ % /Users/wayne/anaconda3/bin/jupyter_mac.command ; exit;
[W 11:28:06.753 NotebookApp] Loading JupyterLab as a classic notebook (v6) extension.
[I 2024-01-24 11:28:06.758 LabApp] JupyterLab extension loaded from /Users/wayne/anaconda3/lib/python3.10/site-packages/jupyterlab
[I 2024-01-24 11:28:06.758 LabApp] JupyterLab application directory is /Users/wayne/anaconda3/share/jupyter/lab
[I 11:28:10.392 NotebookApp] Serving notebooks from local directory: /Users/wayne
[I 11:28:10.393 NotebookApp] Jupyter Notebook 6.5.2 is running at:
[I 11:28:10.393 NotebookApp] http://localhost:8888/?token=0a..........
[I 11:28:10.393 NotebookApp]  or http://127.0.0.1:8888/?token=0a..........
[I 11:28:10.393 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:28:10.397 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///Users/wayne/Library/Jupyter/runtime/nbserver-1806-open.html
    Or copy and paste one of these URLs:

Notice you don’t see anything about AppData which is usually linked to Python installed different ways. And you will notice you see anaconda3/bin/jupyter in part of the paths.
But maybe it is simply explained by the fact you didn’t include all the details? Or it could be a Windows difference, perhaps? (So don’t maybe worry too much until some Windows person chimes in.)

As for the bad descriptor file did you look into here? In that case it was updates that caused issues. Had you had Anaconda installed on that computer before and not known and not cleaned things up adequately before installing it again?

1 Like

I am sorry that I am not following the guide to ask questions in a proper way. I’m just stressed about it because the class starts in this afternoon and I firstly google the problem and find out there is a forum.
The professor records a video for us to prepare for this. After I install Anaconda I open Windows PowerShell and run Python and ask for the version (“python --version”). And the version is Python 3.11.5. Then I run a program called pip to install package called otter grader for homework grading (“pip install otter-grader”). Lastly run the Jupytar notebook program (“Jupyter notebook”) and my professor said it’s part of the Anaconda distribution. After this it’s supposed to jump directly to my web opening the Jupyter but it doesn’t and I find out the proportion of the screenshot is different from what my professor is showing.
I’ve never downloaded Anaconda before.
There is the video link my professor asks us to follow:

I’m really appreciated with your help.

I wouldn’t stress too much. You haven’t even had the first class.
This forum is for general Jupyter use and development. You are trying to use it for a course and hence you should be consulting the course administrators for help, first and foremost.

There’s two ways illustrated here how to open Jupyter via Anaconda, see the second two and try to follow along with them.

In regards to the bad descriptor…

Are you the only one ever to use the computer you are using?
If so, is there any chance your Anaconda Distribution install wasn’t complete or entirely successful. Since you haven’t invested much time yet. Following suggestions to clean up an Anaconda install and re-installing may be in order.
Here more general advice about that bad descriptor stuff and pay close attention to what ‘DonJayamanne’ says about avoiding pip when you are using Anaconda as your package manager. Only use pip as a last resort in that case and make sure it is running in the correct environment.

1 Like

I already sent email to my professor before posting on this forum because I thought maybe there is something I could do before that. But I’m not sure if he would reply it or not since it’s a big lecture with hundreds of people. I’m stressed because the first class is immediately followed by assignment which links with Jupyter notebook.
Besides the the code execution problem, I realize I have installation problem from the begining. If I choose “just me” option at the begining a notice would pops out saying that “destination folder cannot contain non-ascii characters”. But if I instead choose “all users” and enable the installation with administration role, when I open the Windows PowerShell it would directly say “python was not found; run without arguments to install from the microsoft store, or disable this shortcut from settings > manage app execution aliases”.
I am pretty sure I am the only one ever use this computer because I bought a fresh new one straight from the store. And I’ll follow the suggestion.
Thank you so much again for the links you send me and your response. And I will get in touch with my professor and solve this as soon as possible.

Not following, earlier you said the following:

So that was promising before but now is messed up?
And just to stress, you should only follow the ways that Anaconda has set up for you to access Python after installing the Anaconda Distribution. Read and follow the documentation, or related & current advice. You only want to be dealing with the Anaconda-installed stuff.

When I try to install Anaconda it has two options. Either install as “just me” or “all users”. The difference is that later there are few different boxes to check. During the “just me” installation I could add Anaconda to the path environment variable. But in “all users” installation it doesn’t have this option and if I install with this it came with the result showing on Windows PowerShell saying that “no python is found…”

1 Like