HELP! My Jupyter notebook is not showing any outputs. : (

So I am pretty new to Jupyter notebook and have been using it for weeks now. I took a little break from studying python for a week or so and am now trying to get back to it. However, when I opened up my notebook to work yesterday I noticed that when I do enter + shift to get it to run the cell it will not give me an output. I am not sure why this is happening or how to fix it. I do know that I did update my google chrome which is where I open my Jupyter notebook up from. I also tried firefox today and that didn’t work at all.
Can someone tell me what I can do to fix this?

Can you share a screenshot?

ezgif.com-gif-maker
Here is a gif of it.

As you can see, when i run the cell it doesn’t give me an output. It is every frustrating.

Thank you very much for sharing that. I am happy to tell you that your Jupyter Notebook just works fine. It is your expection that needs to be adapted. The Jupyter Notebook only shows what the last statement of a cell evaluates to.

  1. If you define a function, this does not evaluate to anything that could be displayed. So you can’t see anything in the upper cell.

  2. In the function in the upper cell, you set the result equal to some value. But you never return the result. As you don’t have ANY return statement in the function, Python replaces that with None. Your expressions result = XXX mean nothing as you don’t return that result. The chosen name result was freely chosen by you and has no language-specific meaning in Python. After invoking your function, Python happily deletes that variable and does nothing else.

  3. As the function invocation returns None, for the lower cell there is nothing to display.

So I can tell you that everything is working fine. I wish you happy coding and nice experiences with learning Python! I hope you can find nice books or online classes that might help you with your journey.

3 Likes

Something that evaluates well that you can use in an Input cell to test in the future would be the following:

2 + 2

The output should render the result of that.

2 Likes

Ok so I feel…silly. I am taking an Udemy course online and was following along with the instructor doing this problem. I thought I had everything right and checked three times but I guess I missed a return…color me embarrassed. :sweat_smile: It also doesn’t help that it was 1:30 in the morning when I was doing it too. Thanks so much for the help! I will do better to check over my work.

1 Like

Thanks! I will use that as a way to check if its outputting anything.

I guess we all have been there :wink: It’s totally normal.

I also have this problem but with any simple piece of code like 2 + 2 and i dont know how to fix it

You’d have to say more to get any help.
What does the kernel monitor say in the top right corner? Is it busy? What type of kernel are you using? How did you install? Along this line, are you using the Anaconda Distribution on your local machine or a remote machine using JupyterLite?

To get an idea of what you should be seeing it can be helpful to have a place where things should be working…
Did you go here press ‘launch binder’ button and when the session comes up run code in notebooks and compare that temporary session to what you see? That would be a full Python kernel on a remote computer server. For an alternative option that uses a different approach. You can go fo the JupyterLite site and press one of the orange buttons in the upper left and then run code in the notebooks there and compare to what happens on your system. That runs a Pyodide based kernel that is actually making a virtual computer-like system deep inside the inner workings of your browser. However, all the activity and computation is going on inside your local computer only.

1 Like

Hello! sounds like I am facing an issue in Jupyter Notebooks where, after running a code cell to extract and display data (e.g., using print(soup) ), I am not seeing the data itself but, instead, you notice the cell number increment as if the code executed without issues. I have tried toggle scrolling and nothing happens! I don’t know what else to do. Hope someone knows how to fix this problem. I just followed the teachers instructions, I am pretty new too.

It’s print(soup) not print = (soup)

1 Like

Hey! Thanks for pointing out what a dumb mistake I made. I tried erasing the equal sign, but it’s still not working. I don’t get what’s wrong now

Did you do restart the kernel and do ‘Run All’?

I see two cells with In [2] next to them. That shouldn’t happen if you ran each of the cells in order top to bottom. I would expect the cell with print(soup) to say In [3] next to it.
It’s a good habit to get into to restart the kernel and ‘Run All’ regularly. You’ll notice issues that way sooner and keep your notebooks more robust in the long run.

Yes, it worked! Thank you so much! Your help is greatly appreciated! :blush: :heart_eyes: :star_struck:

1 Like