widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.95k stars 236 forks source link

No graphics #350

Open cgarmstr opened 4 years ago

cgarmstr commented 4 years ago

I'm obviously doing something really stupid, so my apologies.. I am using one of the sample programs on a Conda virtualenv with only numpy and ipyvolume installed: import ipyvolume as ipv import numpy as np N = 100 x, y, z = np.random.normal(0, 1, (3, N)) fig = ipv.figure() scatter = ipv.scatter(x, y, z) ipv.show()

I don't get any graphics, just

ipv.show() VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), camera_center=[0.0, 0.0, 0.0], controls=None, height=500, matrix_projection=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], matrix_world=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], scales={'x': LinearScale(max=2.449841813777466, min=-1.8161202829212062), 'y': LinearScale(max=2.4440524618404007, min=-2.408076104580802), 'z': LinearScale(max=1.6276369772492079, min=-2.0090489468131203)}, scatters=[Scatter(color_selected=array('white', dtype='<U5'), line_material=ShaderMaterial(), material=ShaderMaterial(), shader_snippets={'size': '\n'}, size=array(2), size_selected=array(2.6), texture=None, x=array([ 3.50099852e-01, -6.00288822e-01, 3.91342061e-01, 6.29243602e-01, 8.55550853e-01, -4.58904467e-01, 6.12929920e-01, 1.09489421e+00, -6.77522401e-01, 7.98317044e-01, 1.90140773e-01, -7.79114671e-01, ... 1.11541424e-02, -9.38330231e-01, -1.65141756e+00, 3.19769648e-01, 1.87715439e-01, 1.59439538e+00, -1.61753280e+00, -5.96089629e-01]))], scene=Scene(background=None, fog=None, overrideMaterial=None, quaternion=(0.0, 0.0, 0.0, 1.0), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), style={'axes': {'visible': True, 'label': {'color': 'black'}, 'ticklabel': {'color': 'black'}, 'color': 'black'}, 'box': {'visible': True}, 'background-color': 'white'}, width=400),))

When I use the same code in Jupyter Notebook I don't get any output as all.

Python version 3.8.5

(BarePython) C:\Users\cecil>pip list Package Version


argon2-cffi 20.1.0 async-generator 1.10 attrs 20.2.0 backcall 0.2.0 backports.functools-lru-cache 1.6.1 bleach 3.2.0 bqplot 0.12.16 brotlipy 0.7.0 certifi 2020.6.20 cffi 1.14.3 chardet 3.0.4 cloudpickle 1.6.0 colorama 0.4.3 cryptography 3.1 cycler 0.10.0 cytoolz 0.10.1 dask 2.26.0 decorator 4.4.2 defusedxml 0.6.0 entrypoints 0.3 idna 2.10 imagecodecs 2020.5.30 imageio 2.9.0 importlib-metadata 1.7.0 ipydatawidgets 4.0.1 ipykernel 5.3.4 ipython 7.18.1 ipython-genutils 0.2.0 ipyvolume 0.6.0a6 ipywebrtc 0.5.0 ipywidgets 7.5.1 jedi 0.15.2 Jinja2 2.11.2 jsonschema 3.2.0 jupyter-client 6.1.7 jupyter-core 4.6.3 jupyterlab-pygments 0.1.1 kiwisolver 1.2.0 MarkupSafe 1.1.1 matplotlib 3.3.2 mistune 0.8.4 mkl-service 2.3.0 nbclient 0.5.0 nbconvert 6.0.3 nbformat 5.0.7 nest-asyncio 1.4.0 networkx 2.5 notebook 6.1.4 numpy 1.19.1 olefile 0.46 packaging 20.4 pandas 1.1.2 pandocfilters 1.4.2 parso 0.5.2 pickleshare 0.7.5 Pillow 7.2.0 pip 20.2.3 prometheus-client 0.8.0 prompt-toolkit 3.0.7 pycparser 2.20 Pygments 2.7.1 pyOpenSSL 19.1.0 pyparsing 2.4.7 pyrsistent 0.17.3 PySocks 1.7.1 python-dateutil 2.8.1 pythreejs 2.2.0 pytz 2020.1 PyWavelets 1.1.1 pywin32 227 pywinpty 0.5.7 PyYAML 5.3.1 pyzmq 19.0.2 requests 2.24.0 scikit-image 0.17.2 scipy 1.5.0 Send2Trash 1.5.0 setuptools 49.6.0.post20200917 six 1.15.0 terminado 0.8.3 testpath 0.4.4 tifffile 2020.9.3 toolz 0.10.0 tornado 6.0.4 traitlets 4.3.3 traittypes 0.2.1 urllib3 1.25.10 wcwidth 0.2.5 webencodings 0.5.1 wheel 0.35.1 widgetsnbextension 3.5.1 win-inet-pton 1.1.0 wincertstore 0.2 zipp 3.1.0

Reine0017 commented 3 years ago

Hey @cgarmstr, I have the exact same issue, let me know if you manage to find a solution! @maartenbreddels is there a bug?

cgarmstr commented 3 years ago

No, I never did find a solution. I just tried again and trying the same code in a Jupyter notebook give a long error message which began


TypeError Traceback (most recent call last) ~\AppData\Roaming\Python\Python37\site-packages\traitlets\traitlets.py in validate(self, obj, value) 2092 try: -> 2093 value = float(value) 2094 except Exception:

TypeError: float() argument must be a string or a number, not 'NoneType'

During handling of the above exception, another exception occurred: ...

From: Fang Ran notifications@github.com Sent: 13 January 2021 15:41 To: maartenbreddels/ipyvolume ipyvolume@noreply.github.com Cc: Cecil Armstrong cecilgarmstrong@hotmail.com; Mention mention@noreply.github.com Subject: Re: [maartenbreddels/ipyvolume] No graphics (#350)

Hey @cgarmstrhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcgarmstr&data=04%7C01%7C%7C72e802ed8b8741c7910808d8b7d99c11%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461492537167031%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ElIwvXJAiuM3STZb3gMUPWt1KrHZMBfOA5Ln9gdHxS4%3D&reserved=0, I have the exact same issue, let me know if you manage to find a solution!

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmaartenbreddels%2Fipyvolume%2Fissues%2F350%23issuecomment-759530982&data=04%7C01%7C%7C72e802ed8b8741c7910808d8b7d99c11%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461492537177023%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xKNd11F4wx7%2Btd7Mp0colFxrzopLM5YeiQ3xeu%2BJffs%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABYRB6IX5UKQEZTPF3G5DPDSZW5IJANCNFSM4RQ7LFSA&data=04%7C01%7C%7C72e802ed8b8741c7910808d8b7d99c11%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461492537187014%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=J8BZ5hcpGzcpUJQQPbt2egyTSCGaVuHabsduuvmnP2g%3D&reserved=0.

Stefan-Schroder commented 3 years ago

Hi @cgarmstr & @cgarmstr

I don't know if this will help, but I had this problem when working in JupyterLab, it would just show: VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), quaternion=....

It was because I had not installed all the required packages listed in the instructions. For JupyterLab I needed:

Which i install with:

$ conda install -c conda-forge nodejs  # or some other way to have a recent node 
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager
$ jupyter labextension install ipyvolume
$ jupyter labextension install jupyter-threejs

Maybe it is similar for standard jupyter notebooks.

Hope that helps!

cgarmstr commented 3 years ago

I thought you had the solution, but unfortunately not. I followed the official installation instructions like you have above. At the Anaconda prompt when I do jupyter labextension list I get JupyterLab v3.0.8 E:\Users\cecil\miniconda3\share\jupyter\labextensions bqplot v0.5.22 enabled ok jupyterlab-datawidgets v7.0.0 enabled ok @jupyter-widgets/jupyterlab-manager v3.0.0 enabled ok (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab) app dir: E:\users\cecil\miniconda3\share\jupyter\lab ipyvolume v0.5.2 enabled ok jupyter-threejs v2.2.0 enabled ok

In a jupyter lab notebook import ipyvolume as ipv import numpy as np N = 100 x, y, z = np.random.normal(0, 1, (3, N)) fig = ipv.figure() scatter = ipv.scatter(x, y, z) ipv.show() results in Error displaying widget This is further than I've ever got before. Any further ideas to get me over the line? Many thanks!

Stefan-Schroder commented 3 years ago

I think you might be missing the nodejs lab extension. I'm not entirely sure how it works, but i think you have to have the python package of nodejs installed not just nodejs. The reason why I say this is because the output for my: jupyter labextension list is:

JupyterLab v3.1.0a2
/home/stefan/.local/share/jupyter/labextensions
        jupyterlab-datawidgets v7.0.0 enabled OK
        jupyter-matplotlib v0.8.3 enabled OK
        @axlair/jupyterlab_vim v0.13.0 enabled OK (python, jupyterlab_vim)

Other labextensions (built into JupyterLab)
   app dir: /home/stefan/.local/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK
        ipyvolume v0.5.2 enabled OK
        jupyter-threejs v2.2.0 enabled OK
        nodejs v0.0.0 enabled OK

so you have everything except the nodejs v0.0.0

And on my Ubuntu system it was not enough to just $ sudo apt install nodejs I had to install it through conda using $ conda install -c conda-forge nodejs