kernel busy when pylab is used in ipython notebook - matplotlib

I'm using ipython notebook 1.1.0 (and python 2.7.3) on chromium.
When I use pylab and apply
pylab.show()
the ipython notebook freezes with "kernel busy". I've seen that kernel busy is a common bug in ipynb.
After a while on terminal I got:
ATTENTION: default value of option force_s3tc_enable overridden by environment.
Any ideas on what to look for?

are you including "%matplotlib inline" in your code? I had this error, and adding it to my code solved the issue of a hanging kernel.
Check out the official documentation for a more thorough explanation .

Related

Jupyter Notebook Kernel dies when importing tenserflow

I am using Macbook Air with M1 chip. When trying to import tensorflow in Jupyter notebook, the kernel dies and displays a prompt that "Kernel has died and will restart in sometime". Could someone help me fix this?
Tensorflow version - 2.5.0
Python version - 3.8.8
Try running the notebook file within VS Code, there are extensions to help with that. Also check this article on how to install tf on M1 https://towardsdatascience.com/installing-tensorflow-on-the-m1-mac-410bb36b776
It seems this is a recurring issue with multiple people with the m1 macs. Since it is still fairly new, it is possible that Jupiter notebook still doesn't fully support it. Try using anaconda navigator with the windows emulator. Here is a link to a forum post with people having the same problem.
https://github.com/apple/tensorflow_macos/issues/45
Anaconda and upgrading to new M1 Mac

simply importing tensorflow kills my Jupiter notebook kernel

As described in jypyter notebook I tried:
import tensorflow
then my kernel is killed, like "The kernel appears to have died. It will restart automatically."
Tried to reinstall anaconda, numpy, tensorflow, didn't work.
well I also experienced this normally this can't work because tensorflow is too big for jupyter notebook though you may try downloading the anaconda navigator if you don't have it already though this may not work

Conda and Jupyter Notebook Environment Confusion

I am using Jupyter Notebook to help debug some issues I'm having moving between JSON and pandas. The specific application isn't important.
The important part is that I needed to use pandas.json_normalize() which apparently first showed up in pandas version 1.0.3. I was confused when Jupyter said it doesn't exist. I did a version check and got:
In[]: pd.__version
Out[]: 0.25.2
This is not the version of python installed in either my base environment or the conda environment that Jupyter Notebook is running in or that the app is running in. Version checks in both environments in Anaconda Prompt (outside of Jupyter Notebook) confirm this.
What is going on here? Looking around I haven't seen a good answer, but it does appear that other people have had the same issue --- Jupyter defaulting to pandas 0.25.2 for some reason.
It seems that your Notebook is using a different kernel/environment than what you want.
run this in the notebook to see which environment you are using
! which python
or try
import sys
print(sys.executable)
which would show you which environment it's using, if you have env named venv then you will get something like.
/home/your_home_directory/anaconda3/envs/venv/bin/python
If you don't care about all of that and you just want to update the pandas that it's using then copy that path and do this.
! pip install --upgrade pandas
Note that this will also depend on which version of python you are using

Cannot change to a different GUI toolkit: notebook - Warning in Jupyter

I want to use the interactive plots in jupyter, but when switching the backend to notebook, I get the warning:
Warning: Cannot change to a different GUI toolkit: notebook. Using qt5 instead.
This happens on Windows 10, Anaconda 1.8.7, jupyter 5.5.0, python 3.6.5 and matplotlib 2.2.2.
Minimal working example:
import matplotlib.pyplot as plt
%matplotlib notebook
Output:
Warning: Cannot change to a different GUI toolkit: notebook. Using qt5 instead.
I found some question here where the problem is the other way around, but could not find anyone having this problem yet.
In some cases, importing ipympl is mentioned as a solution, but this does not change anything in my case.
Any hints?
As ImportanceOfBeingErnest pointed out in the comments, my problem was related to the backend already being set when jupyter starts. However, as mentioned in this post, the backend needs to be set in the ipython_config.py, not the jupyter_notebook_config.py.
After restarting the notebook server, I can switch between backends as described here.
You must put %matplotlib widget in the very beginning of the Jupyterlab

Can't run Tensorflow on GPU within jupyter-notebook

I can't be able to run the tensorflow code with GPU when I ran it from a jupyter notebook. Same code runs no problem, if I ran in a python script.
I followed the main installation link:
https://www.tensorflow.org/install/install_windows
Also tried:
http://bailiwick.io/2017/11/05/tensorflow-gpu-windows-and-jupyter/
No problems outside notebook when I ran in a python script file.
Most likely the problem is similar to this:
Tensorflow not running on GPU in jupyter notebook
More specifically my test:
I can see both devices CPU and GPU via python a script
I can see only CPU via notebook
Thanks a lot for any help in advance!
Very late, but short answer:
Here is a Tutorial on how to set up a GPU-based Jupyterlab instance with Docker (which makes the installation faster).
I hope this helps!
I removed all existing environments and created a new one, which resolved the issue.
(Also, I had to apply the following to get around an issue caused by removed environments:
https://github.com/jupyter/notebook/issues/2301
)