how come cells do not display all my code?

41 views
Skip to first unread message

Andy Davidson

unread,
Jan 30, 2018, 6:39:50 PM1/30/18
to Project Jupyter
Hi

I recently started using Jupyter notebooks. I noticed that if I load a notebook or restart my kernel I have to manually click in each cell to get all the python code to display. This is very tedious and time consuming. My notebook takes a long time to run so most of the time I do not want to run everything

Kind regards

Andy

$ python3 --version

Python 3.6.1

$ jupyter --version

4.4.0


$ pip3 list  |grep jupyter

jupyter (1.0.0)

jupyter-client (5.2.1)

jupyter-console (5.2.0)

jupyter-core (4.4.0)


chrome Version 63.0.3239.13

macOS High Sierra

Roland Weber

unread,
Jan 31, 2018, 2:30:27 AM1/31/18
to Project Jupyter
Hello Andy,

is this about displaying the Python *code*, or the *output* when you run the code?

Restarting the kernel should have no effect on what is being displayed. Unless you select "Restart & Clear Output", in which case it is expected that all output gets cleared.

If your problem is missing output, you don't have to run each cell manually. Select "Kernel -> Restart & Run All" to restart the kernel and run all cells, or "Cell -> Run All" to run all cells without restarting the kernel.

If you save your notebook before stopping Jupyter or closing the browser, the output should still be displayed next time you load it. The state in memory will be gone of course, similar to when you restart the kernel.

The menu items I quoted are from a newer version of Jupyter Notebook. They may have had slightly different names in the version 4.4 you are using. Version 5.4 is available by now, so you might want to upgrade.

hope that helps,
  Roland

Andy Davidson

unread,
Feb 2, 2018, 4:33:39 PM2/2/18
to jup...@googlegroups.com
Hi Roland


From: <jup...@googlegroups.com> on behalf of Roland Weber <rolw...@de.ibm.com>
Reply-To: <jup...@googlegroups.com>
Date: Tuesday, January 30, 2018 at 11:30 PM
To: Project Jupyter <jup...@googlegroups.com>
Subject: [jupyter] Re: how come cells do not display all my code?

Hello Andy,

is this about displaying the Python *code*, or the *output* when you run the code?

My problem with code. output is always displayed correct. I have tried your suggestions with out any luck. Every time I start my notebook or restart it have to click in each cell to cause all the python source to be displayed

I  am running Jupyter on my local machine. I notice the following on start up

[I 13:30:55.704 NotebookApp] Accepting one-time-token-authenticated connection from ::1

[W 13:31:06.901 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20180201133054 (::1) 13.58ms referer=http://localhost:8888/notebooks/logisticRegression.ipynb

[I 13:31:07.632 NotebookApp] Kernel started: 42777506-bc3d-4b95-b2f6-7d821d1f6ffc

[I 13:31:08.556 NotebookApp] Adapting to protocol v5.1 for kernel 42777506-bc3d-4b95-b2f6-7d821d1f6ffc


Found the following https://github.com/jupyter/help/issues/186


The following got rid of the console error, how ever I still have the same original problem


$ jupyter nbextension enable --py widgetsnbextension

Enabling notebook extension jupyter-js-widgets/extension...

      - Validating: OK


jq "." ~/.jupyter/nbconfig/notebook.json

{

  "aedwip_comment": {

    "howToWrapText""https://stackoverflow.com/questions/36419342/how-to-wrap-code-text-in-jupyter-notebooks"

  },

  "MarkdownCell": {

    "cm_config": {

      "lineWrapping"true

    }

  },

  "CodeCell": {

    "cm_config": {

      "lineWrapping"true

    }

  }

}


I noticed that it seems like about half of the python source lines are being displayed in my code cells. Not sure why clicking on the cell would cause everything to be displayed?

Any suggestions would be greatly appreciated

Andy

Roland Weber

unread,
Feb 5, 2018, 2:02:56 AM2/5/18
to Project Jupyter
Hello Andy,

maybe there's something in the default stylesheet. I know that long output is shown with a scrollbar by default, but you can click to the left of the output to have that section expanded. Could be that the same thing is in effect for code cells as well.

cheers,
  Roland

Thomas Kluyver

unread,
Feb 5, 2018, 5:36:14 AM2/5/18
to Project Jupyter
Do you have any extensions or custom config in your browser? Can you reproduce the problem in another browser?

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/59261ea3-6454-4a17-9a99-1992ce21ec34%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Andy Davidson

unread,
Feb 6, 2018, 6:49:37 PM2/6/18
to jup...@googlegroups.com
Hi Rolan

I am able to reproduce the problem in both chrome and safari running on mac os high Serria.

Turnning lineWrapping off in codeCell’s seems to have resolved the problem. I am not sure if this is a bug or a feature. What I wanted was to format my python code cells so that all the code would always be displayed even if line # are displayed or I download to html or pdf. I did not want ot have to manualy insert line breaks or do other formating. Maybe there is a better way to  get this kind of functionalty?

Kind regards

Andy


$ cat ~/.jupyter/nbconfig/notebook.json

{

    "aedwip_comment": {

        "howToWrapText":"https://stackoverflow.com/questions/36419342/how-to-wrap-code-text-in-jupyter-notebooks"

    },

  "MarkdownCell": {

    "cm_config": {

      "lineWrapping": true

    }

  },

  "CodeCell": {

    "cm_config": {

      "lineWrapping": false

    }

  }

}


From: <jup...@googlegroups.com> on behalf of Thomas Kluyver <tak...@gmail.com>
Reply-To: <jup...@googlegroups.com>
Date: Monday, February 5, 2018 at 2:35 AM
To: Project Jupyter <jup...@googlegroups.com>
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages