Widgets not showing in NBViewer - python-3.x

I have an iPython Notebook with an interactive slider widget:
To share the notebook, I would like to use the link provided by NBViewer. This would allow me to share the notebook with people that don't use Python. Unfortunately, the widget does not show when viewing the NBViewer link:
Is there something I need to do to make widgets work with NBViewer?

Widgets are not shown in nbviewer with current ipython 2.x.
IPython 3 is supposed to add persistent widgets that can be shown by nbviewer.
The release of ipython 3 was scheduled for this fall but it is likely to happen early next year.

I had to downgrade ipywidget from version 7.0.3 to get nbviewer showing ipywidget.
pip install ipywidgets==6.0.0

Related

How to use processing.py in google colaboratory

Recently I've been studying a lot on the processing library (mainly using p5.js) and was delighted to find out that in the processing IDE, there is a python mode, processing.py.
I want to try using it in google colaboratory. I tried using pip install to install it in colab and in the console it said it was installed successfully but when I try running a script that usually runs in the python mode of the processing IDE, it doesn't work. Below is a screen cap of the code and the error. In the processing IDE, (without the last 2 lines), this will show a 400 x 400 gray canvas with a circle drawn at its center.
I also tried installing java into the colab just in case processing.py requires java. Nothing seems to work though. For those who want to see the entire notebook, here is the link: https://colab.research.google.com/drive/19UVAR2iOWk4NnrHxNhd_XL03MUoKrCF3?usp=sharing It is set so that anyone with the link can open it.
I hope someone can help me with this. Thanks very much.
I'm afraid it is not possible to use https://py.processing.org on Colab, as it is based on the Jython interpreter, a Python 2 that runs on the Java Virtual Machine (the upside of Jython being that we can use most of the librairies created by the Processing Java community, available with a few clicks from the IDE).
You might be able to run this new experimental "Processing in Python 3" project on Colab: https://github.com/p5py/p5
There is a new p5 library in pyPI that can be installed:
!pip install -U p5
import p5
However, I have had problems getting the chart to show. I believe that the problem is getting Colab to write to my display. It would be great if someone could solve this...

How can Pycharm (with matplotlib) show me my graphs in the same Py charm, next to my code?. Not in additional windows

i am using Matplotlib with Pycharm in a Mac osx. When I am making a graph, and I code plt.show() pycharm opens another window. And if there is 2 graphs, to see the 2nd one I have to close the first one. And I want to see both together.
There is a option to show the two graph in the same window, where my code is?
Thanks very much.
This link may help:
IPython magic commands
Using Jupyter notebooks you can achieve what you want by using %matplotlib inline. It seems from the link above that PyCharm may have some way to enable this same functionality.
See also: Inline plots in the scientific view

Anaconda on Mac: Can't set Matplotlib backend to Agg

I want to set Spyder to use a non-interactive matplotlib backend, so that plot figures do not pop up but I can still save figures to file, like this hint.
However, it looks like Spyder automatically imports matplotlib and sets the backend internally somewhere, so any call I make to matplotlib.use() pops an error saying that MPL has already been called.
Prefs show that "automatically import PyLab" is disabled. Also there is no 'Agg' backend in the dropdown list.
How do I use a non-interactive backend?
Or preferably: how can I allow command-line setting of the backend again? (I would like my script to choose whether to use the interactive/non-interactive backends depending on some variables, before MPL import.)
Spyder prefs Screenshot:
Versions/attempt, on Mac OS 10.13.6 (shows MPL already imported!):
Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:07:29)
IPython 6.5.0 -- An enhanced Interactive Python.
>> matplotlib
Using matplotlib backend: Qt5Agg
(Spyder maintainer here) As mentioned by #ImportanceOfBeingErnest in his comment above, you simply need to turn off the option called Activate Support in the screenshot you posted to be able to set by yourself the Matplotlib backend you want to use in your code.

Warning in Spyder iPython window whenever I create a canvas in Vispy

Every time I create a vispy Canvas instance in Spyder:
from vispy import app
class Canvas(app.Canvas):
def __init__(self):
app.Canvas.__init__(self)
canvas = Canvas()
I start to get warnings like the following in the iPython window:
WARNING: QSocketNotifier: Multiple socket notifiers for same socket 1048 and type Read
Once the canvas instance is created, whenever I type in the iPython console in Spyder, this error starts to occur, so I can't do things like explore modules via tab completion (the warning obliterates the dropdown menu). It also tends to randomly insert itself in stack traces and other places in the console, generally disrupting my workflow (in non-catastrophic ways).
I tried turning off the Warning by turning off Real-time code analysis, as suggested here:
How to suppress a certain warning in Spyder editor?
But it didn't affect the behavior.
I am in Spyder version: 3.2.8 (in an environment that includes spyder-kernels 0.2.6), Python version: 3.6.6, Qt version: 5.6.2, PyQt5 version: 5.6 in Windows 10. This has happened on all three Windows 10 machines I use. I'm running this all in Anaconda. When I run the above code just in the python shell, or from the pure iPython shell, I do not get the warning.

Highlight to select and Middle-button to paste in jupyter notebook?

In Jupyter Notebook, when I highlight text either from within a cell in the notebook or from outside the notebook, Middle-Button click doesn't paste anything as it is supposed to do in many other applications in linux. Is there any setting that would allow one to be able to paste with a Middle-Button click into an Ipython or Jupyter Notebook?
I'm using the notebook in firefox if that matters.
The fact that you're using Firefox definitely matters. See this issue on CodeMirror (CodeMirror is the text editor that Juypter uses): Issue #931
In that thread, it references this Firefox issue: https://bugzilla.mozilla.org/show_bug.cgi?id=846674
It seems as though the issue has only recently been fixed, so it may take a little bit to trickle into CodeMirror. You may want to comment on the issue in CodeMirror to inform them that the issue has been fixed on FF and it might prompt them to investigate.
However, Jupyter doesn't automatically use the most recent version of CodeMirror so again you may have to wait a while. If this issue is truly critical then I suggest switching to another browser.

Resources