Kernel loading forever in jupyter notebook - jupyter-notebook

I'm using OSX Yosemite.
I've update ipython via conda and turns out notebook also has updated version, which I'm very excited to try this.The notebook has been converted into jupyter.
I'm using python 2.X, and already have existing .ipynb files. When I open it, new window appears but there's blank and nothing. I can create first cell there, but I already have my notebook. And the kernel also loading forever. There isn't any error log in the console. What do I have to do? Please help!

Nevermind, this solve the problem https://github.com/ipython/ipython/issues/5746
I'm using ccp notebook extension, and as Ian Hawke mentioned in the thread, remove the call to the extention at profile/static/custom/custom.js

Related

jupyter notebook reindex with pandas error

I'm having a strange issue. I have a problem with reindexing when i call my script with a jupyter notebook but it work fine when i call it directly using pycharm.
The first time i execute the notebook after i just started jupyter notebook it work but then it never work again. And it give me this error :
ValueError: cannot reindex from a duplicate axis
I suspect a problem between pandas and jupyter notebook. Because this error never appear when i use pycharm.
Do you have any idea on how i can fix this problem so that i can call my script from a jupyter notebook ?
I'm using the same conda env for both the jupyter notebook and pycharm.
I fond that Jupiter-notebook does not re-import the modules every time you execute it.
I had a problem with a variable that was not overwrite I changed the constructor of my script to be able to rewrite it and it work fine now.

Table of Contents disappeared in Jupyter Notebook

Currently, a jupyter notebook does not show the lateral table of contents. All the other notebooks do.
In fact, for that notebook under menu->edit the nbextensions config disappeared, so, it looks like that notebook does not load the extension.
My jupyter version is 4.4.0.
How to fix that notebook?
I found the solution to this problem. All those advises like "close and then re-open", "clean output of the notebook" or "re-install extensions" won't work. The problem is in the javascript load timeouts.
In firefox press F12 and press on the red icon in the top right corner - you will see that you have an error
Load timeout for modules:
custom/custom,nbextensions/nbextensions_configurator/config_menu/main,
bla-bla-bla...
How to solve:
close the notebook in jupyter, open your ipynb file in any text editor, go to the end of it - you will find "metadata" section. Add the line
"setTimeout": 120
create a file ~/.jupyter/custom/custom.js if you don't have it (I have Linux, where it is in Windows - I have no idea, google for it) and put this contents into this file:
window.requirejs.config({
waitseconds: 90, // default is 30s
});
This page describes the problem in detail:
https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1195
In my case, disabling my ad-blocker brought the table of contents back.
Apparently, all it needs is to shutdown the notebook. After restarting it, all works fine. I suppose that problem happens when the notebook has been closed wrongly without the proper "close and halt" procedure.
My solution in these cases is, make a copy (File <Make a Copy), delete the original notebook and rename the copy (File <Rename)
For me it seems that one of the following steps worked:
Update all packages and jupyter notebook to the latest version using conda
Uninstall then install again the nbextensions configurator
Reboot the computer
For me the reason was 22 emojis in the headers, deleting 5 of them was enough for firefox to get toc back with no reloading and kernel operations.
I have the problem with Jupyter notebook version 6.1.4. After installing nbextensions and enabling extension "Table of Contents (2)" (as "toc" and "toc2" don't work), I cannot obtain the TOC of an a notebook (2.8 MB), while new notebooks have a table of contents.
Reloading, reopening, restarting jupyter does not help, even after a long wait (> 15 min).
I have tried with browsers Mozilla Firefox version 83 and Chromium version 87.
However, a workaround is to create a new notebook (with TOC), then copy all cells from old notebook to new notebook. In order to do this, this might be useful:
how to copy cells from notebook to notebook and
how to select all cells.
Actually I could not copy all cells at once, I had to do three partial copies.
Alas, my method is not only painful but also ineffective in the long term, as the TOC disappeared again.
Restarting the computer worked or did not work.
Opening a small notebook with a table of content and reloading the big notebook worked or did not work.
The problem concerns all Nbextensions, they are just not active for the big notebook. A Javascript console is shown in Google Chrome with Control Shift J.
Error: Load timeout for modules:
nbextensions/nbextensions_configurator/config_menu/main,nbextensions/init_cell/main,nbextensions/spellchecker/main,nbextensions/toc2/main,nbextensions/jupyter-js-widgets/extension

jupyter notebook takes forever to open and then pages unresponsive - [MathJax] issue

I'm trying to open a jupyter notebook and it takes a long time and I see at the bottom it's trying to load various [MathJax] extension, e.g. at the bottom left of the chrome browser it says:
Loading [MathJax]/extensions/safe.js
Eventually, the notebook loads, but it's frozen and then at the bottom left it keeps showing that it's trying to load other [MathJax] .js files.
Meanwhile, the "pages unresponsive do you want to kill them" pop up keeps popping up.
I have no equations or plots in my notebook so I can't understand what is going on. My notebook never did this before.
I googled this and some people said to delete the ipython checkpoints. Where would those be? I'm on Mac OS and using Anaconda.
conda install -c conda-forge nbstripout
nbstripout filename.ipynb. Make sure that there is no whitespace in the filename.
I had a feeling that the program in my Jupyter notebook was stuck trying to produce some output, so I restarted the kernel and cleared output and that seemed to do the trick!
If Jupyter crashes while opening the ipynb file, try "using nbstripout to clear output directly from the .ipynb file via command line"(bndwang). Install with pip install nbstripout
I was having the same problem with jupyter notebook. My recommendations to you are as follows:
First, check the size of the .ipynb file you are trying to open. Probably the file size is in MB and is large. One of the reasons for this might be the output of a dataset that you previously displayed all rows.
For example;
In order to check the dataset, sometimes I use pd.set_option('display.max_rows', None) instead of the .head() function. And so I view all the rows in the data set.
The large number of outputs increases the file size, making the notebook slower. Try to delete such outputs.
I think this will solve your problem.
Here restarting your kernel will not help. Instead use nbstripout to strip the output from command line.
Run this command -> nbstripout FILE.ipynb
Install nbstripout if it is not there
https://pypi.org/project/nbstripout/
It happened to me the time I decided to print a matrix for 100000 times. The notebook file became 150MB and Jupyter (in Chrome) was not able to open it: it said all the things you experienced and then the page died saying it was "OutOfMemory".
I solved the issue opening it in Visual Studio Code, there is a button "Clear All Output", then I saved the notebook again and it was back to some hundreds of KB, which I could open normally.
If you don't have Visual Studio Code installed, you can open the notebook with another editor (gedit if you use Linux or Notepad++ in Windows) and try to delete the output cells. This is more tricky since you have to pay a lot of attention in what you are deleting, otherwise the notebook will stop working.

Unable to create a Julia file using Jupyter Notebook in Chrome browser

I am trying to write Julia using Jupyter Notebook in Google Chrome browser but when I click on New, I do not get the option of creating a new Julia file (shown in the screenshot). I have already added the package- IJulia. What am I missing?
I've seen this before. Doing a Pkg.build("IJulia") and then restart Jupyter fixed it for me.
EDIT: corrected capitalisation

RStudio empty on startup - No windows, no menus, no rendering

When I start RStudio, none of the windows inside the main frame come up, and none of the menu options display menu options when clicked. It's just an blank page.
It feels like some kind of graphics rendering or window management problem.
I'm running Windows 7. I have the latest version of R, which is 3.1.1. I have the latest RStudio, which is 98.1062.
How to fix it?
Reset the RStudio state. Do this:
Close RStudio if open.
Go to this directory: %localappdata%\RStudio-Desktop
Rename that directory as a type of backup.
Start RStudio.
RStudio will see the configuration directory is missing and regenerate it with correct values.
Everything should work after that.
Other threads I found helpful here are:
https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-s-State
https://support.rstudio.com/hc/communities/public/questions/200666647-RStudio-096-16-Windows-7-gives-empty-screen?locale=en-us
Thanks!
Renaming the RStudio state by renaming %localappdata%\RStudio-Desktop did not work for me. However i made it work by renaming another config folder in %appdata% instead.
Close RStudio
Go to this directory: %appdata%\RStudio
Rename the folder
Restart RStudio
I faced the same issue when I downgraded my version of R.
I did try the above solutions. However, it didn't work for me.
After some googling, I found out that the issue was because now I had a different version of R installed. Here's how you can choose the version of R and rectify the issue.
Navigate to the RStudio installation folder. (C:\Program Files\RStudio\bin)
Press and hold Control Key
Double click on rstudio.exe
Choose a specific version of R (whichever you want to work with)
Click OK and RStudio should open without any issues.
NB: I use 64bit Windows 8.1.
I had the same issue and I almost gave up about solving it but then I found a suggestion that GitHub might be the problem. I am not sure how that is happening but the minute I uninstalled GitHub and re-launched Rstudio, it worked perfectly as nothing happened!? Here is the link for where I found the suggestion on Rstudio community page: (https://support.rstudio.com/hc/communities/public/questions/200983187-R-studio-0-98-797-for-mac-opens-as-blank-white-page)
I had the same problem and figured out that for some reason R was blocked on the step of loading my library from a website (I added it to Rprofile for auto-load). You can test the following:
1) Try to run just R console, not RStudio, and then click on blank space - normally some information should appear
2) Try to launch without network connection
On a Mac (Running Yosemite 10.10.3) this is what worked for me:
Move/Rename ~/.rstudio-desktop
(Many responses have mentioned this, but this by itself didn't help.)
Then I shutdown my Mac and restarted it. RStudio worked when I logged back in.
Before that, I tried every one of the steps mentioned here and in many other links, including re-downloading R and RStudio, but unfortunately none of those steps helped in my case.
Search this documentation for 'Blank GUI'.
This is what I found which worked for me:
In Windows Explorer, go to C:\Users\currentUser\AppData\Roaming\RStudio.
Delete the Desktop.ini file
This technique forces RStudio to refresh and default to open-source R as the engine
Same issue I faced so I unistalled the windows installer and downloaded zip version from this link https://www.rstudio.com/products/rstudio/download/
Unziped It and pasted it into c drive and created shortcut from Rstudio/bin/rstudio.exe file.
Working properly after that no issue. In windows installer checked that r session is not working due to an missing dll.
So try to install from ZIP
I had the same problem like Thomas
When I start RStudio, none on the windows inside the main frame come up, and none of the menu options display menu options when clicked. It's just an blank page.
My problem was, that i uninstalled R because is thought RStudio will work on its own.
So i uninstalled RStudio and deleting every existing file which was created by R or RStudio.
In the next step i installed RStudio again.
It was asking for a Version of R (which i dont had in this state). So i installed R again and everything is working fine now. I hope this helps
I had a slight variation of the problem that might be of interest. I had set up an aliases.cmd to run my cygwin bash shell automatically upon launch of a cmd terminal as per:
https://superuser.com/questions/302194/automatically-executing-commands-when-a-command-prompt-is-opened
What RStudio was doing was launching a few cmd windows in the background to (I assume) populate each pane and the console.
This was triggering a bash shell which wasn't returning and was hanging RStudio.
If you have this issue you can just manually kill the sub bash terminals spawned by cmd via ProcessExplorer/TaskManager and RStudio will continue to launch normally.
If anyone else has set anything to launch automatically on init of a cmd terminal then this could interfere in the same way with RStudio.
The RStudio devs could probably fix this behind the scenes by changing the way they spawn cmd terminals in the gui.
I had a similar problem. After trying the options above with no luck, I uninstalled Rx64 3.5.0 and installed an older version, R x64 3.2.2.
Rstudio then worked perfect.

Resources