No output from a Jupyter Notebook in PyCharm 2017.2.2

Answered

I'm trying to follow your tutorial on how to use PyCharm and Jupyter and getting stuck fairly quickly.

I type in the first line and hit shift enter and get the notebook running:

I click on + and create a new cell. In that cell, I type print(1+2) and I hit shift-enter

But not much happens. I do see:

  • A 302 get / added to the Run window
  • the notebook's In[] fields now have an asterisk in them

But that's it.

I expected to see an output field with a number like 3 or similar in it.

This is on

  1. Windows 7 64
  2. PyCharm Community 2017.2.2
  3. Using Python 3.6 from Python.org

What do you supposed I am doing wrong?

1
15 comments

As I see from your screenshot you have 0 active kernels and the cells haven't been executed because they have `*` mark.

Please go to `Settings| Project| Project| Project interpreter` and update the following packages:

ipykernel
notebook
ipython
jupyter

Then try to run the cells again. What result do you have? If you still have a problem please attach a screenshot with  `Settings| Project| Project| Project interpreter`.

0

So I did that, the only package that was behind the times was notebook which was 5.0.0 and is now 5.1.0rc2.

Regardless, the behavior is identical to the above.

If I then click on the URL http://127.0..1:8888 in the Run window, the "expected" Jupyter notebook screen is opened in Chrome and then opening this notebook, MatplotlibExample.ipynb runs as expected.

It looks like this:

and

 

 

 

 

 

 

 

 

 

 

0

Please, upload your log file with a unique name on ftp://ftp.intellij.net/.

And by the way, do you have the dialog "Connecting to Jupyter Notebook server" when you're trying to execute the second cell?

0

I'm not sure what log file you want. Apart from the screen shots in the Run box, what are you looking for?

And no, the "Connecting..." only occurs with the first cell. At which point I hit cancel and then click Run Jupyter Notebook.

0

Jerry Asher, excuse me, that I forgot to specify the log location. I want to see PyCharm Logs, that you can find by going to "Help-> Show Logs In...". Thank you!

0

Hmm. It's been quite a while since I've used ftp, but I think I failed.

I was getting 550 operation not permitted uploading it to / and pub. It looks like it worked uploading jerryasher.jupyter.log.7z to /.uploads, but while the transfer seems to have gone through, no file is listed in that directory.

I'd be happy to email it, or send you a link to it on dropbox.

0

Sure. Please, send me it to valentina.kiryushkina at jetbrains.com

0

Jerry Asher, thanks for sending logs. The cause of a problem is that when you're running notebook PyCharm expects to see an address with token parameter (like this http://localhost:8888/?token=8a091bed34073b1e1476bcc9d83383630274a68e05dff0c2) and yes, it's our bug. For some reason, you don't have these token. Please, check NotebookApp.token parameter in Jupyter Notebook config file. If this parameter is empty string it means that authentication is disabled and it's not recommended. More info you can find here

0

Aha! Thanks Valentina, I blew away ~/.jupyter and restarted pycharm and the cells now run.

I am still trying to understand how to use PyCharm to debug a Jupyter notebook. If I am given a notebook with some hairy function defined in a cell, can I use PyCharm to debug that function as I would use PyCharm to debug any other python function? If so,how?

 

1

Jerry Asher, unfortunately, you can't debug notebook in PyCharm.

0

Oh, well that's both understandable and a bit of a shame. Thanks!

0

I have the same problem: I type something in a cell, press Shift+Enter and nothing. Sometimes after 3 or 5 attempts it prints something.

PyCharm 2018.1.4 (Professional Edition)
Build #PY-181.5087.37, built on May 24, 2018
Subscription is active until October 9, 2018
JRE: 1.8.0_152-release-1136-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.17.3-1-ARCH

0

Hi!

Please, upload your log file with a unique name on ftp://ftp.intellij.net/. You can find logs by going to "Help-> Show Logs In...".

Thank you!

0

I'd like to, but '501 Invalid number of arguments' from FTP server doesn't let me.

0

Oh, sorry about that.
Please send me it to valentina.kiryushkina at jetbrains.com

0

Please sign in to leave a comment.