Closed fitoprincipe closed 5 years ago
Hi @fitoprincipe,
Just in case, are you sure you are running JupyterLab in the same environment?
Could you try creating a core widget like an IntSlider
? Does it work?
Hi @martinRenou,
IntSlider
and other widgets work fine. The only widget that doesn't is ipyleaflet
. When I downgrade to the version I was using previously it works fine. How do I register it as a widget module (as the error says)?
I am on Linux Mint. I run Jupyter Lab from terminal:
~$ jupyter lab
To install new kernels I use this guide.
I have added some paths to PYTHONPATH
by modifying the .profile
file in my user folder.
Last week I added to it a local forked version of ipyleaflet
to start "playing around" and see if I can contribute. Yesterday, when it stopped working, I removed that entry from PYTHONPATH
and let the kernel use the vesion installed in the virtual enviroment, but isn't working. For working, I can downgrade, but as I'd like to contribute I need some help to get over this. Thank you =)
Can you try jupyter nbextension list
?
If it says that ipyleaflet
is disabled you should try running
jupyter nbextension install --py --symlink --sys-prefix ipyleaflet
jupyter nbextension enable --py --sys-prefix ipyleaflet
This is the result of jupyter nbextension list
:
Known nbextensions: config dir: /home/labgeo1/.jupyter/nbconfig notebook section jupyter-js-widgets/extension enabled
- Validating: OK test enabled
- Validating: problems found:
- require? X test config dir: /home/labgeo1/Python/envs/geepy3/etc/jupyter/nbconfig notebook section jupyter-js-widgets/extension enabled
- Validating: OK jupyter-leaflet/extension enabled
- Validating: OK config dir: /usr/local/etc/jupyter/nbconfig notebook section bqplot/extension enabled
- Validating: OK jupyter-leaflet/extension enabled
- Validating: OK jupyter-vega/index enabled
- Validating: OK jupyter-js-widgets/extension enabled
- Validating: OK
That would be awesome if you could contribute! How did you install ipyleaflet? Did you follow the guide for installing ipyleaflet from sources?
Kind of.. I didn't use -e
when pip install .
and didn't execute the last two:
$ jupyter nbextension install --py --symlink --sys-prefix ipyleaflet $ jupyter nbextension enable --py --sys-prefix ipyleaflet
But first I'd like to solve the issue of not showing the map.. if I can't understand why it isn't working in a normal workflow, I won't feel confortable for contribution..
The thing is I think you have a broken installation. Maybe you installed ipyleaflet first using conda
or pip
, then you partially installed ipyleaflet from sources, and there might be a conflict between the two versions you installed. Removing ipyleaflet and installing it again from sources (following the guide) would be a good option.
Once installed from sources, you would need to run jupyter labextension install js
from the root of the ipyleaflet directory in order to install the right JavaScript code for the lab extension
Ok, I'll try that and let you know. Is there something else to do for uninstalling beside pip uninstall
?
And another question, can I have a virtual environment for the developing version (from source) and another for the stable version? since I use it in my every day job
My guess is that you first installed an earlier ipyleaflet
version than 0.10.1
using pip (e.g. 0.9.0). Then tried to install from sources using master
, which is 0.10.1
. But you partially installed from sources, you only installed the Python code, and it does not find the JavaScript code for 0.10.1
. That could be why it complains.
Is there something else to do for uninstalling beside pip uninstall?
That should do the trick if you only installed using pip
can I have a virtual environment for the developing version (from source) and another for the stable version?
I think so. I don't know what you are using for creating a virtual environment, but creating a separate virtual env with Jupyter and ipyleaflet in it for development sounds like a good idea :)
In the last part is where I get a little confuse.. I use virtualenv
to create virtual environments for python, but as far as I know it does not isolate binaries like Jupyter.. how could I make a virtual environment with a different Jupyter (without using Docker)?
For example, when running
$ jupyter nbextension install --py --symlink --sys-prefix ipyleaflet $ jupyter nbextension enable --py --sys-prefix ipyleaflet
does the same if the environment is activated or not... does it?
as far as I know it does not isolate binaries like Jupyter
That's not what I would expect... What does it say if you do which jupyter
? I think it depends if you installed jupyter globally or not.
If you installed jupyter globally (not when the environment is activated) then I guess which jupyter
will say the same thing in and out of the environment.
If you installed jupyter in the environment and globally, then which jupyter
should say different things in and out of the environment.
If you only installed jupyter in the environment, I expect jupyter
to fail with a Command jupyter not found
when out of the environment.
EDIT: For example if I run which jupyter
from my ipyleaflet
conda environment it says /home/martin/miniconda3/envs/ipyleaflet/bin/jupyter
. If I run it globally it says nothing because jupyter is not installed globally.
You are right, it DOES isolate Jupyer.. great! when environment is activated:
(geepy3) $ which jupyter (geepy3) $ /home/labgeo1/Python/envs/geepy3/bin/jupyter
when not environment is activated:
$ which jupyer $ /usr/local/bin/jupyter
But I always run it from the global scope, and install kernels for each environment using the guide I told you before.. maybe I just should run the jupyter installed in each environment.. I'll try that!
Thank you @martinRenou! you've been really helpful =)
Oh yeah, that could be your issue :) Happy I could help! I think it is best practice to have the minimum installed in the global environment, and only have isolated environments for each project/task you have. This way you do not depend on packages from a different environment and you don't have version collisions like the one you have.
Ok, I have done some steps.. created a clean virtual environment using virtualenv
and installed ipyleaflet
from source as you suggested, and checked which jupyter
to ensure it's running from the correct environment.. but I think the local installation of it is messing it up..
(env) $ jupyter lab [I 10:29:25.730 LabApp] JupyterLab extension loaded from /usr/local/lib/python2.7/dist-packages/jupyterlab [I 10:29:25.730 LabApp] JupyterLab application directory is /usr/local/share/jupyter/lab [W 10:29:25.751 LabApp] JupyterLab server extension not enabled, manually loading... [I 10:29:25.752 LabApp] JupyterLab extension loaded from /usr/local/lib/python2.7/dist-packages/jupyterlab
should I uninstall jupyter from the local scope?
Yeah I think it would be cleaner. Then you would have to run pip install jupyter
from your environment and other environments that needs it
Ok I'll try that! Thank you =)
I made all steps I can think off.. but no luck with Jupyter Lab.. it works fine in Jupyter Notebook..
$ jupyter nbextension list
Known nbextensions:
config dir: /home/labgeo1/.jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
config dir: /home/labgeo1/Python/envs/ipyleaflet/etc/jupyter/nbconfig
notebook section
jupyter-leaflet/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
When Jupyter Lab starts:
[I 12:12:23.709 LabApp] The port 8888 is already in use, trying another port.
[I 12:12:23.722 LabApp] JupyterLab extension loaded from /home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab
[I 12:12:23.722 LabApp] JupyterLab application directory is /home/labgeo1/Python/envs/ipyleaflet/share/jupyter/lab
[W 12:12:23.724 LabApp] JupyterLab server extension not enabled, manually loading...
[I 12:12:23.729 LabApp] JupyterLab extension loaded from /home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab
[I 12:12:23.729 LabApp] JupyterLab application directory is /home/labgeo1/Python/envs/ipyleaflet/share/jupyter/lab
[I 12:12:23.730 LabApp] Serving notebooks from local directory: /home/labgeo1/Python/notebooks
[I 12:12:23.730 LabApp] The Jupyter Notebook is running at:
[I 12:12:23.730 LabApp] http://localhost:8889/?token=becdba02e97e5fdff3467beb07193398e28974a992a7d266
[I 12:12:23.730 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:12:23.733 LabApp]
To access the notebook, open this file in a browser:
file:///run/user/1000/jupyter/nbserver-28016-open.html
Or copy and paste one of these URLs:
http://localhost:8889/?token=becdba02e97e5fdff3467beb07193398e28974a992a7d266
Se creó una nueva ventana en la sesión existente del navegador.
[I 12:12:26.050 LabApp] Node v8.11.1
[I 12:12:26.137 LabApp] Build is up to date
[I 12:12:26.753 LabApp] Kernel started: 69cc6408-89b1-4631-9868-1545903d76fd
[I 12:12:28.478 LabApp] Adapting to protocol v5.1 for kernel 69cc6408-89b1-4631-9868-1545903d76fd
[I 12:12:28.498 LabApp] Adapting to protocol v5.1 for kernel 69cc6408-89b1-4631-9868-1545903d76fd
[I 12:13:05.315 LabApp] Starting buffering for 69cc6408-89b1-4631-9868-1545903d76fd:3d83db55-5cfb-4000-a2c9-84c3678bdf74
all paths are within the virtual environment now.. but the error is exactly the same as the first issue post
Ok, do you have core widgets working?
yes, I forgot to mention.. IntSlider
is working fine
Did you run jupyter labextension install js
after following the installation from sources instructions?
Nope, I didn't see that command.. I ran it now but fails..
output (with --debug):
Traceback (most recent call last):
File "/home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab/labextensions.py", line 77, in start
ans = self.run_task()
File "/home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab/labextensions.py", line 106, in run_task
for arg in self.extra_args
File "/home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab/labextensions.py", line 106, in <listcomp>
for arg in self.extra_args
File "/home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab/commands.py", line 219, in install_extension
return handler.install_extension(extension)
File "/home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab/commands.py", line 418, in install_extension
info = self._install_extension(extension, tempdir)
File "/home/labgeo1/Python/envs/ipyleaflet/lib/python3.5/site-packages/jupyterlab/commands.py", line 1257, in _install_extension
raise ValueError(msg % (extension, '\n'.join(messages)))
ValueError: "js" is not a valid extension:
No `jupyterlab` key
Errored, use --debug for full output:
ValueError: "js" is not a valid extension:
No `jupyterlab` key
Nope, I didn't see that command
Yes we need to improve the documentation.. Also you need nodejs
installed for this command to work.
I'm unsure what this error message means... Maybe you did not run it from the ipyleaflet
root directory? In the command js
points to the js
subdirectory in the ipyleaflet repo.
That is it! It's working now, thank you!!
My final question before closing the issue, how do you handle development process?? when you make a change, what you do? reinstall everything?? This is why I put development packages in my pythonpath.. so if I make a change, I just rerun the kernel and that's it, I can quickly test the change..
That is it! It's working now, thank you!!
Awesome!
how do you handle development process??
Well, it depends.
If you are working on the Python code and you installed it using -e
, you only need to restart the kernel and you would see your changes.
If you are working on the JavaScript code:
npm run watch
from the js
directory, this command will run infinitely and build the JavaScript bundle every single time there is a change detected in the JavaScript code. The fact that you installed the nbextension using the --symlink
option allows it. Once you built the bundle using NPM, you would need to refresh the page of your notebook in order to load the new JavaScript code.npm run watch
from the js
directory, the other one running jupyter lab --watch
from any directory. This second command will rebuild JupyterLab every time there is a change in the ipyleaflet labextension, it can be very slow when having a lot of labextensions.This should be part of the documentation as well...
I personally prefer developing on the classical Notebook, it is a lot faster. And you can check that your changes work on JupyterLab as well once you are done developing (and it should work).
Very valuable information! Once again, thank you @martinRenou! Closing now =)
Sure! :)
Try to reopen Jupyter notebook, the the map will display
Hi,
ipyleaflet
was working fine in Jupyter Lab until today.I read https://github.com/jupyter-widgets/ipyleaflet/issues/202, so I checked
node
. I'm using version 8.11.1.Just in case, I run
jupyter labextension install jupyter-leaflet
andjupyter labextension install @jupyter-widgets/jupyterlab-manager
, but no luck.It's working fine in a Jupyter Notebook