Ipyvolume in Datalore - plot

I have tried to run the most basic Ipyvolume code in my Datalore notebook, unfortunately It didn't display anythong. The code:
import ipyvolume as ipv
import numpy as np
x, y, z = np.random.random((3, 10000))
ipv.quickscatter(x, y, z, size=1, marker="sphere")
It shows only a blanc line after running it.
I had configured the notebook settings in the init.sh file, however it didn't make any difference. Here are the settings I have tried:
pip install ipyvolume
jupyter nbextension enable --py --sys-prefix ipyvolume
jupyter nbextension enable --py --sys-prefix widgetsnbextension
I just want to see 3D (nifti) images in 3D as I can do it with ITKSnap. As far as I know Ipyvolume is the best suited library for that and should be working perfectly fine with jupyter notebooks. I don't know what should I do when using specifically Datalore notebook.
Thanks in advance for the help.

Related

Unable to find uhd devices when running on both terminal

I use jupyter notebook to run the python example for the UHD. When I run the command on jupyter notebook for multiple times, it just keep showing me the kernel has dead. Besides, when I run the uhd_find_devices again in my ubuntu terminal, it shows uhd device not found. When I switch off the jupyter notebook, it is now showing the uhd devices. Any way to make it connected to both way and solve this issue??
I just run this on jupyter notebook
import uhd
import numpy as np
usrp = uhd.usrp.MultiUSRP()

start jupyter lab in different folder (windows)

For jupyter notebooks, I can do:
jupyter notebook --ExtractOutputPreprocessor.enabled=False --notebook-dir C:/Bla
so I tried something similar for jupyter lab:
jupyter lab --app-dir C:/Bla
but get:
JupyterLab Error
JupyterLab application assets not found in "C:/Bla"
Please run `jupyter lab build` or use a different app directory
I did a few google searches without a clear answer. Could someone please enlighten me? Thanks.
Don't use --app-dir - this is for custom deployments of JupyterLab.
notebook-dir should work fine, as well as ServerApp.root_dir:
jupyter lab --notebook-dir C:/Bla
or
jupyter lab --ServerApp.root_dir C:/Bla
Unless you have a very old version of JupyterLab installed (in that case - upgrade).

pip install environment_kernels Not Working for Switching Conda Environment

Even after I install the kernal package by calling pip install environment_kernels in anaconda prompt, I'm still not able to change the environment in my Jupyter notebook.
This is how it looks like on the top right corner of a ipynb file when I click into
And here's what shows up when I click Kernel tab to try to switch to another environment.
And I'm honestly so confused why I don't even have a conda tab on the main page.
Can somebody help me out on this?
you could try to set the display-name, then you can see it in change kernal
python -m ipykernel install --user --name yourenvnamehere --display-name "the display name you want there"

Jupyter Notebook in virtual environment doesn't see the virtual env packages

I'm trying to use a Jupyter Notebook in a virtual environment.
I have created a new virtualenv virtualenv ker12
+ activate + installed a specific version of keras or any other library.
also as mentioned in Using a virtualenv in an IPython notebook I did:
pip install ipykernel
and
python -m ipykernel install --user --name=my-virtualenv-name
when I run the notebook and write
! which jupyter the output is correct
/Users/myname/virtualenv/ker12/bin/python
but when I try to import a library, for example import keras there is an error.
ImportError: No module named keras
But from the other side when I write pip freeze | grep Keras
the output is:
Keras==1.2.0
UPDATE 1:
this problem is not related to Keras it occurs with any other library (for example pandas)
If I print os.path the output is following:
<'module 'posixpath' from /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.pyc>
From a "command line python" the os.path looks correct
<'module 'posixpath' from '/Users/my_name/virtualenv/ker12/lib/python2.7/posixpath.pyc'>
UPDATE 2:
If I print sys.path from terminal and jupyter the output is also different:
from terminal
/Users/myname/virtualenv/ker12/lib/python27.zip
/Users/myname/virtualenv/ker12/lib/python2.7
/Users/myname/virtualenv/ker12/lib/python2.7/plat-darwin
/Users/myname/virtualenv/ker12/lib/python2.7/plat-mac
/Users/myname/virtualenv/ker12/lib/python2.7/plat-mac/lib-scriptpackages
/Users/myname/virtualenv/ker12/lib/python2.7/lib-tk
/Users/myname/virtualenv/ker12/lib/python2.7/lib-old
/Users/myname/virtualenv/ker12/lib/python2.7/lib-dynload
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Users/myname/virtualenv/ker12/lib/python2.7/site-packages
from JUPYTER
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages
/usr/local/lib/python2.7/site-packages/IPython/extensions
/Users/myname/.ipython `
the solution is to open jupyter notebook with following command:
~/virtualenv/my_venv_name/bin/jupyter-notebook
You should not install ipykernel - instead, you should go for a full Jupyter installation (pip install jupyter) inside your virtual environment. Additionally, be sure that you don't create your virtual environment with the --system-site-packages option.
See also this answer.

what is the ipython notebook "Terminals" menu option

I am running ipython notebook on my OSX machine and/or my ubuntu 14.04 machine. I am using ipython 3.0.0, and ipython (jupyter) notebooks.
When I start an ipython notebook, under New there is a terminal option, but it's unavailable for me.
I haven't been able to find any documentation on this feature, how to activate it or what it does.
The ipython notebook --help command doesn't mention it and I haven't found anything in the documentation either.
I haven't discovered the special keywords to search google for to get any information either.
What does this feature do? How do I activate it? Is there any documentation on this available?
IPython/Jupyter appears to support browser-based interactive terminal sessions. This is enabled on my machine by installing the terminado package with pip or conda. This fixes the "Terminals Unavailable" message on the drop-down, and lets me start up a (bash) terminal session in a new tab.
See this commit:
IPython on GitHub
Here's the code in Lib/site-packages/IPython/html/notebookapp.py responsible for this item (located the file by searching the source for "Terminals" case-sensitively):
def init_terminals(self):
try:
from .terminal import initialize
initialize(self.web_app)
self.web_app.settings['terminals_available'] = True
except ImportError as e:
log = self.log.debug if sys.platform == 'win32' else self.log.warn
log("Terminals not available (error was %s)", e)
As you can see, there should be a message in the console log specifying what went wrong (you may need to increase log verbosity with ipython notebook --log-level=<level> to see it). In my case, it said:
Terminals not available (error was No module named fcntl)
The html.terminal module that is being imported appears to provide a web-based IPython interactive console.
Support for Windows terminals with terminado dependency was added in Jupyter 5.3.0:
https://github.com/jupyter/notebook/pull/3087
Actually it's jupyter notebook 5.3.0, not jupyter. the two versions is not the same thing.
- jupyter --version
- jupyter notebook --version
I ever suffered from this.

Resources