Sync Jupyter notebook with Python session - python

I'm starting to use Python and Jupyter notebook for data analysis. I like Jupyter notebook but I sometimes prefers to use Spyder to have a quick look at the objets saved in memory (variables, dataframes, ...)
That's why I'd like to know if it's possible to have a shared
workspace between a Python session open in an IDE (like Spyder or Rodeo) and a notebook, so I can share object and avoid executing the same code twice to have the best of both world.

At least in theory, Spyder supports connecting to an external IPython kernel (e.g. one managed by Jupyter Notebook) via the "Connect to existing kernel" option: https://pythonhosted.org/spyder/ipythonconsole.html
The connection info for that can be obtained as described in http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Connecting%20with%20the%20Qt%20Console.html#Manual-connection
Unfortunately, that isn't actually working for me with Fedora 24's Spyder (2.3.9) and IPython (3.2.1), so I'm marking this answer as Community Wiki.

Related

Jupyter notebook renders text instead of ipywidgets

My Jupyter notebook is displaying text rather than ipywidgets. Here is a screenshot:
I read several posts about similar problems, like this one:
Jupyter Notebook not rendering ipywidgets.
Most of them indicate that the solution is to enable an extension, e.g: https://stackoverflow.com/a/38001920/11692496
But it seems to apply to older version of jupyter notebooks. I tried it anyway (with the --sys-prefix argument, which is required for virtualenv), but it didn't fix it.
I'm working with a jupyter notebook and a virtualenv. Just to be sure, I created a fresh venv and installed the minimal packages. No luck.
I'm using Python 3.10.6 and here is my versions list:
Thanks for your help!
For the record, I didn't manage to solve this issue on my virtualenv.
As #Wayne suggested above, I went for a workaround, namely a docker container based on jupyter/tensorflow-notebook

jupyter notebook not showing python option under new

I am having a problem with creating a new ipython notebook.
Previously I used to do that going to new -> python
but now I am unable to see any python option.
Also, I am unable to open any ipython notebooks, I have one uploading for hours now.
I recently erased my %temp% folder to free some space in the C drive. Does that have something to do with this? How do I fix this?
I solved the problem!
For some reason, jupyter labs was not installed
So running the command
jupyter -- version
and then checking what all was installed, I found out that jupyter labs was not installed?
pip3 install jupyter labs
so I went ahead and installed it and everything works as it did before.
Still don't know the reason why this all happened in particular. If anyone could help me with that'd be awesome!
I'm not sure 100% but this is most commonly related to an ipython jupyter notebook file error. I do recommend to do a clean install of the notebook and try again. As I don't have any specifications on your system is difficult to guide you on the process. But that is the best option you have now.
Also this could have happened because of an update on python, jupyter, your system or any base component required by jupyter or python.

jupyter notebook on AWS

I have set up a Jupyter notebook on an AWS box, or so I thought. When I try jupyter notebook, however, I get this:
[C 16:22:30.841 NotebookApp] The 'kernel_spec_manager_class' trait of instance must be a type, but 'environment_kernels.EnvironmentKernelSpecManager' could not be imported
Any suggestions on how to fix?
EDIT actually, when I run jupyter notebook in the base environment, it works (I can't connect to it, but that's obviously a separate problem). However, in a "nonstandard" environment, it does not start. To answer the questions, this is an ubuntu 18.04 deep learning image, and in the environment I had installed jupyter and jupyterlab (via anaconda)
The issue seems to be same as the one described here:
environment_kernels.EnvironmentKernelSpecManager could not be imported
Since in your question you have not indicated that you've tried that, I think that the solution proposed in the link could be tried:
pip install environment_kernels

Not able to display altair charts in jupyter notebook

I am not able to display the charts on jupyter notebook. The same code displays on chrome in one laptop but does not work on chrome on other laptop.
I do not see any error or even a empty plot when I execute the code but get alt.Chart(...) in the output.
The version of altair and vega etc are same on both the laptops.
For 'altair' version of '4.1.0',
'vega' version of '3.4.0'
just do alt.renderers.enable('default') instead of
alt.renderers.enable('notebook')
If it works in one notebook and not another, there are a couple possibilities for what is going on:
your notebooks are connected to different kernels with different versions of Altair and/or its dependencies installed. Run the following
import sys
print(sys.executable)
to see if you're using the same Python executable in your environments. If the results are different, you can use Kernel -> Change Kernel in the Jupyter notebook menu to change to a kernel with a working Altair version.
If that's not the case, then it is likely that you have inadvertently enabled a different renderer in one of the notebooks, for example by running alt.renderers.enable('notebook'). In Altair 4.0, the default renderer should work out-of-the-box in both Jupyter notebook and JupyterLab. Either restart your kernel or run alt.renderers.enable('default') to restore the default.
The behavior above can happen if you have too old a version of IPython installed. See If the notebook displays on one laptop and not the other, it may be that the broken one has too old a version of IPython installed. See https://altair-viz.github.io/user_guide/troubleshooting.html#notebook-textual-chart-representation for more information on what to upgrade.
See Altair's Display Troubleshooting guide for more information.

Gremlin-python in jupyter notebook

I`m trying to use tinkerpop3.2.3 to conncet janusgraph0.1.1 on my centOS7, everything works fine in gremlin shell. I tried to use gremlin-python3.2.3 in python shell, it also works well. But when I moved my codes to jupyter notebook, I got RuntimeError:IOLoop is already running when excuting
g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
So, is that possible to make gremlinpython work in jupyter notebook?
I tried both python2.7 & python3.5
The issue you are seeing is more at the Apache TinkerPop level. JanusGraph 0.1.1 ships with TinkerPop 3.2.3, and the error you are seeing was resolved with TinkerPop 3.2.5.
The master branch of JanusGraph is already at TinkerPop 3.2.6, so it is compatible with Jupyter notebooks, but you'd have to build JanusGraph from source code. I'd expect the next release of JanusGraph to be out later this month.

Categories

Resources