widgetti / ipyvolume

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

Jupyter Lab installation error #324

Open Hackathorn opened 4 years ago

Hackathorn commented 4 years ago

Followed the installation steps in github. When running the Quick Intro examples, I get...

import numpy as np import ipyvolume as ipv V = np.zeros((128,128,128)) # our 3d array . . . . . . . ipv.quickvolshow(V, level=[0.25, 0.75], opacity=0.03, level_width=0.1, data_min=0, data_max=1)

C:\Users\Richard\anaconda3\envs\netcdf\lib\site-packages\ipyvolume\serialize.py:81: RuntimeWarning: invalid value encountered in true_divide gradient = gradient / np.sqrt(gradient[0]2 + gradient[1]2 + gradient[2]**2) Error displaying widget

Also try second example... x, y, z = np.random.random((3, 10000)) ipv.quickscatter(x, y, z, size=1, marker="sphere")

Error displaying widget

Here are environment packages & versions... environment.yml.txt

Thank you for your assistance....

TimoFriedri commented 4 years ago

I can confirm this, for multiple jupyterlab versions: 1; 1.1; 1.2; 2.0 and 2.1

TimoFriedri commented 4 years ago

321

More or less duplicate ...

jaewooklee93 commented 4 years ago

Cannot install ipyvolume on jupyterlab=1.2.6.

I tried all of these.

$ conda install -c conda-forge ipyvolume

$ 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
piotrm0 commented 4 years ago

I'm having the same problem. Here is what the javascript console outputs when this happens. I've also seen similar errors with other extensions.

Uncaught (in promise) Error: Module ipyvolume, semver range ~0.5.2 is not registered as a widget module
    at y.loadClass (manager.js:319)
    at y.<anonymous> (manager-base.js:264)
    at s (manager-base.js:45)
    at Object.next (manager-base.js:26)
    at manager-base.js:20
    at new Promise (<anonymous>)
    at F (manager-base.js:16)
    at y.e._make_model (manager-base.js:258)
    at y.<anonymous> (manager-base.js:247)
    at s (manager-base.js:45)
sdesrozis commented 4 years ago

Same issue. Installation seems good following installation guidelines. But Error displaying widget... First error was related to missing bqplot lab extension. Now I have

Module ipyvolume, semver range ~0.6.0-alpha.4 is not registered as a widget module

Note that ipyleaflet and ipywidgets are ok.

My config

(ipyvolume) desrozis@8ce0cf338e23:/work$ jupyter labextension list
JupyterLab v2.0.1
Known labextensions:
   app dir: /opt/conda/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        bqplot v0.5.12  enabled  OK
        ipyvolume v0.6.0-alpha.4  enabled  OK
        jupyter-leaflet v0.13.0  enabled  OK
        jupyter-threejs v2.2.0  enabled  OK

and

ipydatawidgets            4.0.1                      py_0    conda-forge
ipykernel                 5.1.4            py38h39e3cac_0    defaults
ipyleaflet                0.13.0             pyh9f0ad1d_0    conda-forge
ipyscales                 0.4.0                      py_1    conda-forge
ipython                   7.13.0           py38h5ca1d4c_0    defaults
ipython_genutils          0.2.0                    py38_0    defaults
ipyvolume                 0.6.0a4            pyh9f0ad1d_0    conda-forge
ipywebrtc                 0.5.0                    py38_0    conda-forge
ipywidgets                7.5.1                      py_0    defaults

Any help is welcome !!

joequant commented 4 years ago

I'm getting the following error when I try to install from the github repo

installing pip from

https://github.com/maartenbreddels/ipyvolume/tarball/master jupyter labextension install ipyvolume

/usr/lib/python3.8/site-packages/setuptools/dist.py:454: UserWarning: Normalizing '0.6.0-alpha.5' to '0.6.0a5' warnings.warn(tmpl.format(locals())) rebuilding js and css failed missing files: ['/tmp/pip-req-build-euqmpajn/ipyvolume/static/extension.js', '/tmp/pip-req-build-euqmpajn/ipyvolume/static/index.js', '/tmp/pip-req-build-euqmpajn/ipyvolume/static/three.js'] Traceback (most recent call last): File "", line 1, in File "/tmp/pip-req-build-euqmpajn/setup.py", line 199, in setup(setup_args) File "/usr/lib/python3.8/site-packages/setuptools/init.py", line 144, in setup return distutils.core.setup(**attrs) File "/usr/lib64/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib64/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/lib64/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-req-build-euqmpajn/setup.py", line 67, in run raise e File "/tmp/pip-req-build-euqmpajn/setup.py", line 60, in run self.distribution.run_command('jsdeps') File "/usr/lib64/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-req-build-euqmpajn/setup.py", line 144, in run raise ValueError(msg) ValueError: Missing file: /tmp/pip-req-build-euqmpajn/ipyvolume/static/extension.js

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

chriotte commented 4 years ago

Hi guys! I've possibly identified and fixed the last bit in the puzzle to get ipyvolume working in JL2.

I first tried installing the latest version from conda without luck, then tried pip installing the latest version from Git, still no luck.. after some digging it turns its missing one python module (bqplot) and one node module (source-map).

Here are the steps I took to fix it: 1 - download the repo to a local folder github.com/maartenbreddels/ipyvolume 2 - run: npm install source-map 3 - cd into the downloaded folder and run: python3 setup.py install
4 - run: conda install -c conda-forge bqplot 5: run: jupyter labextension install bqplot

Depending on your setup, it's important that step 3 is run as a python command and not using eg pip, I had a problem where the installer tried to use Python 2.7 and failed.

I ran this code to test it:

import ipyvolume as ipv
import numpy as np
N = 1000
x, y, z = np.random.normal(0, 1, (3, N))

fig = ipv.figure()
scatter = ipv.scatter(x, y, z)
ipv.show()

AND BAM! ipyvolume is back in action. image

I presume to fix the Conda conda/pip package we have to add bqplot and source-map to the requirements?

Edit: Tagging @agoose77 to bring this post to your attention

agoose77 commented 4 years ago

Hi @chriotte, nice work!

I found that bqplot is a hard dependency, I can't remember if I discussed it with @maartenbreddels - good find, we should fix that.

As for source map, I haven't needed it to install ipyvolume - how did you determine it was necessary? :)

chriotte commented 4 years ago

Thank you @agoose77 for your swift reply! I can imagine this being a perfect example of a dependency hell with a mix of complex python and node modules! :)

Regarding source map, I had noticed "missing source-map" references in two places: 1 - The developer console in Firefox pointing to missing source map after doing a "clean" install from conda 2 - When I tried installing the latest version from Git using: pip install git+git://github.com/maartenbreddels/ipyvolume The pip install threw an exception because source-map was not found, after installing source map I were able to proceed further along in the install process, but ran into a new problem where the installer tried calling python 2.7 instead of 3 (despite my python 3 conda env being activated in the terminal). I'm attaching the stack trace from running the command without source-map as a text file - made the relevant line bold. Also attaching the Python stack trace just for reference, but that is most likely more to do with my setup than ipyvolume.

ipyvolume_install_stacktrace.zip

chriotte commented 4 years ago

Hi again guys, I was curious about whether the latest code from the Github repo is needed in the steps outlined above, so I created a new conda env, but this with the latest version of ipyvolume from Conda and not Github.

steps taken:

1 - make a shiny new conda env 2 - install Jl2 3 - install ipyvolume from conda directly 4 - does it work? Nope 5 - ipywidgets lab extension not found, installing it.. 6 - does it work? nope, can't find bqplot 7 - install bqplot from conda, does it work nope? But bqplot was already satisfied, hmm 8 - install the bqplot lab extension, and rebuild JL2. Does it work? YES

*error message in firefox dev console

Conclusion! Looks like the missing like is the bqplot JL extension, and just doing: "jupyter labextension install bqplot" might be enough. It didn't complain about source-map this time, but that might just be because I already did a npm install, and it would be great if someone that have NOT manaully installed source-map could give this a try.

agoose77 commented 4 years ago

Are you familiar with Docker? I previously built a Docker image to test things in an isolated env, and found that we only need bqplot to be installed: https://github.com/maartenbreddels/ipyvolume/pull/323#issuecomment-635939797

joequant commented 4 years ago

Can confirm that it works for me.

The process I used was

  1. install source-map by npm
  2. install bqplot by pip3
  3. install ipyvolume==0.6.0a by pip3
  4. install bqplot by jupyter labextension
  5. install ipyvolume by juputer labextension

On Thu, Jul 2, 2020 at 8:26 PM Angus Hollands notifications@github.com wrote:

Are you familiar with Docker? I previously built a Docker image to test things in an isolated env, and found that we only need bqplot to be installed:

323 (comment)

https://github.com/maartenbreddels/ipyvolume/pull/323#issuecomment-635939797

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/maartenbreddels/ipyvolume/issues/324#issuecomment-652975460, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWGAGNNONGFQMX3XBSE2CLRZR4IJANCNFSM4MWZ3AJA .

consideRatio commented 4 years ago

This seemed to be sufficient for me, where --pre give me ipyvolume==0.6.0a6 atm.

pip install --pre ipyvolume
jupyter labextension install @jupyter-widgets/jupyterlab-manager bqplot ipyvolume
pratulyab commented 4 years ago

Resolves this issue for me as well (python 3.6.9 jupyterlab 2.1.4 )

(in addition to the installation steps mentioned in docs)

fschiffers commented 4 years ago

Just confirming that I was able to install it correctly with the help of the last 2 comments.

Installation gave me a lot of headaches and I wasn't able to install it a few weeks back.

Khoa-NT commented 3 years ago

I tried from pratulyab but I still get the error Error displaying widget: model not found

My jupyter lab:

jupyter core     : 4.7.1
jupyter-notebook : 6.4.0
qtconsole        : not installed
ipython          : 7.19.0
ipykernel        : 5.5.5
jupyter client   : 6.1.12
jupyter lab      : 3.0.16
nbconvert        : 6.0.7
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5

Only works on Jupyter Notebook

agoose77 commented 3 years ago

@Khoa-NT how did you install ipyvolume? It isn't listed here.

Khoa-NT commented 3 years ago

I'm sorry, That is the result from jupyter --version

This is from jupyter labextension list

JupyterLab v3.0.16
/opt/conda/share/jupyter/labextensions
        jupyter-matplotlib v0.9.0 enabled OK
        bqplot v0.5.28 enabled OK (python, bqplot)
        jupyter-webrtc v0.6.0 enabled OK
        ipygany v0.5.0 enabled OK
        jupyterlab-datawidgets v7.0.0 enabled OK
        jupyter-threejs v2.3.0 enabled OK (python, pythreejs)
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /opt/conda/share/jupyter/lab
        ipyvolume v0.6.0-alpha.8 enabled OK
        jupyterlab-dash v0.4.0 enabled OK
        jupyterlab-plotly v4.14.3 enabled OK
        k3d v2.9.6 enabled OK

I tried ipyvolume, K3D Jupyter and ipygany. But None of them can run on Jupyterlab even I installed their jupyterlab extention. Only can run on Jupyter Notebook. So I have to use Plotly temporarily

agoose77 commented 3 years ago

It looks like you've installed ipyvolume using jupyter labextension install. With the latest alpha, you don't need to do that, and generally it is better to use the pre-built extensions (as it avoids the sometimes problematic build step). I would suggest uninstalling the ipyvolume labextension via jupyter labextension uninstall, and then install the package from PyPI.

The actual problem here is probably that the bqplot version is not correct. ipyvolume depends upon bqplot, but doesn't have control over its version, so sometimes the two can drift out of sync.