Giter Club home page Giter Club logo

Comments (24)

giswqs avatar giswqs commented on July 17, 2024 2

@jmp75 Thanks for the troubleshooting. For users who are having difficulty displaying the map, you can enable the ipyleaflet extension using the following two commands. Then you can type jupyter nbextension list to see whether the extension has been enabled successfully.

jupyter nbextension install --py --symlink --sys-prefix ipyleaflet
jupyter nbextension enable --py --sys-prefix ipyleaflet

from geemap.

jmp75 avatar jmp75 commented on July 17, 2024 1

Solution:

Reading ipyleaflet issue 504 I forced a reinstall of the jupyter-leaflet extension from the command line:

conda activate sv # or whatever you have named it
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet

jupyter-nbextension list has the same output as before, but now the notebook does display the widget as expected. One conclusion is that you should prefer the command line for installing extensions, rather the jupyter-lab triggered 'Build"

Hope this helps.

from geemap.

jmp75 avatar jmp75 commented on July 17, 2024 1

A precision for jupyterlab users, widget registrations are not the same as for jupyter-notebook. To check which extension is registered you should use jupyter labextension list and expect an output like:

JupyterLab v2.0.0
Known labextensions:
   app dir: /home/xxxyyy/anaconda3/envs/sv/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        bqplot v0.5.10  enabled  OK
        jupyter-leaflet v0.12.4  enabled  OK

from geemap.

nanodan avatar nanodan commented on July 17, 2024 1

Only way I could get this working was to fork it, modify requirements file to remove ipyevents, set ipyleaflet to 0.13.6, install ipyevents after fixed dependencies.. then uninstall ipyevents from jupyterlab, while leaving it as a package, and rebuild jupyterlab, while version-fixing a whole bunch of dependencies.

.bat file

pipenv install
pipenv run pip install GDAL-3.2.1-cp39-cp39-win_amd64.whl
pipenv run pip install rasterio-1.2.0-cp39-cp39-win_amd64.whl
pipenv run pip install -r requirements_fulllist.txt
pipenv run jupyter labextension uninstall ipyevents
pipenv run jupyter lab build

where requirements_fulllist.txt is:

git+https://github.com/nanodan/geemap
affine==2.3.0
anyio==2.0.2
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.3.0
Babel==2.9.0
backcall==0.2.0
bleach==3.3.0
branca==0.4.2
certifi==2020.12.5
cffi==1.14.4
chardet==4.0.0
click==7.1.2
click-plugins==1.1.1
cligj==0.7.1
colorama==0.4.4
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
idna==2.10
ipykernel==5.4.3
ipyleaflet==0.13.6
ipython==7.20.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==2.11.3
json5==0.9.5
jsonschema==3.2.0
jupyter-client==6.1.11
jupyter-core==4.7.1
jupyter-server==1.3.0
jupyterlab==3.0.7
jupyterlab-pygments==0.1.2
jupyterlab-server==2.2.0
jupyterlab-widgets==1.0.0
MarkupSafe==1.1.1
mistune==0.8.4
nbclassic==0.2.6
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.1.2
nest-asyncio==1.5.1
notebook==6.2.0
numpy==1.20.0
packaging==20.9
pandocfilters==1.4.3
parso==0.8.1
pickleshare==0.7.5
prometheus-client==0.9.0
prompt-toolkit==3.0.14
pycparser==2.20
Pygments==2.7.4
pyparsing==2.4.7
pyrsistent==0.17.3
python-dateutil==2.8.1
pytz==2021.1
pywin32==300
pywinpty==0.5.7
pyzmq==22.0.2
requests==2.25.1
Send2Trash==1.5.0
Shapely==1.7.1
six==1.15.0
sniffio==1.2.0
snuggs==1.4.7
terminado==0.9.2
testpath==0.4.4
tornado==6.1
traitlets==5.0.5
traittypes==0.2.1
urllib3==1.26.3
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
ipyevents

Hopefully this helps somebody.

from geemap.

giswqs avatar giswqs commented on July 17, 2024 1

@robmarkcole This is an ipyleaflet problem rather than geemap. Check jupyter-widgets/ipyleaflet#739 to see if it helps. You can also check out the geemap docker images at https://geemap.org/installation/#use-docker

from geemap.

jwingnut avatar jwingnut commented on July 17, 2024 1

I was almost able to follow the solution from @nanodan nanodan to get geemap to work on Jupyter Lab but I needed to modify it slightly.

I downloaded GDAL-3.2.3-cp38-cp38-win_amd64.whl and rasterio-1.2.3-cp38-cp38-win_amd64.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and replaced those file names in the .bat file.

I'm using conda so I also ran:
conda create geelab python=3.8
conda activate geelab
conda install mamba -c conda-forge

pipenv install
pipenv run pip install GDAL-3.2.3-cp38-cp38-win_amd64.whl --force-reinstall
pipenv run pip install rasterio-1.2.3-cp38-cp38-win_amd64.whl --force-reinstall
pipenv run mamba install -c conda-forge nodejs
pipenv run pip install -r requirements_fulllist.txt
pipenv run jupyter labextension uninstall ipyevents
pipenv run jupyter lab build
pipenv run mamba install -c conda-forge pywin32

then you can start Jupyter Lab with geemap by running
pipenv run jupyter lab

Once you have Jupyter Lab running try running:
import geemap
m = geemap.Map()
m

You will get an error that says something like:
FileNotFoundError: Could not find module 'c:\users\me.virtualenvs\me-ym2aifmq\Library\bin\geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.

Instead of "me" in the folder names it will be your user name.

Then you have to create the "Library" and "bin" folder where they are expected (from the error), and copy the geos_c.dll from the "me-ym2aifmq\Lib\site-packages\osgeo" folder to the bin folder you just created (I tried with the shapely provided geos_c.dll and it doesn't work).

Now if you try running that cell in Jupyter Lab again it will display a map.

This is a very convoluted solution but it does so far seem to work. Also I'm not sure how great of a practice it is to be using conda with pipenv.

Anyways, it'd be great to not have to do all this. But since @nanodan had got it working and I had to do some more stuff to get it to work on my end I thought I'd share my solution. Any idea of when there will be a better solution?

from geemap.

LucaD81 avatar LucaD81 commented on July 17, 2024

the solution proposed is not working for me...
only way to work for me is:

import geemap.eefolium as geemap
Map = geemap.Map()
Map

However, in a later stage I try to add layers (following tutorial #12):

Add Earth Engine dataset

dem = ee.Image('USGS/SRTMGL1_003')

Set visualization parameters.

dem_vis = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']}

Add Earth Engine DEM to map

Map.addLayer(dem, dem_vis, 'SRTM DEM')

I cannot see any layers, Dont know why...

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@LucaD81 How did you install geemap? Try the following commands:

conda create -n gee python=3.8
conda activate gee
pip install geemap

from geemap.

LucaD81 avatar LucaD81 commented on July 17, 2024

Hi, thanks for your quick response!
Previsouly I installed using: conda install -c conda-forge geemap
Now I run your command lines, but unfortunately it's still not working.
When using import geemap.eefolium as geemap, it's opening the interactive-map, but after adding layers, I cannot see the layers anyway...thanks!

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@LucaD81

conda activate gee
jupyter nbextension install --py --symlink --sys-prefix ipyleaflet
jupyter nbextension enable --py --sys-prefix ipyleaflet

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@LucaD81 You can also try Google Colab if you cannot get geemap to work on your computer. See this example.

from geemap.

LucaD81 avatar LucaD81 commented on July 17, 2024

I tried commands of above and that's what I've got:
RuntimeError: The current Numpy installation ('c:\users\lucad\.conda\envs\gee\lib\site-packages\numpy\init.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86

for GColab ok, but I've read there might be some issues with other packages

from geemap.

giswqs avatar giswqs commented on July 17, 2024

See this.

conda activate gee
pip install numpy==1.19.3

from geemap.

LucaD81 avatar LucaD81 commented on July 17, 2024

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@LucaD81 Try creating a fresh conda env to install ipyleaflet first. Make sure that you can show an ipyleaflet map before installing geemap. If ipyleaflet does not work properly, geemap won't work either.

https://ipyleaflet.readthedocs.io/en/latest/installation.html

import ipyleaflet
m = ipyleaflet.Map()
m

from geemap.

nanodan avatar nanodan commented on July 17, 2024

I have this same issue. It's an issue with leaflet. Upgrading leaflet to 0.13.6 solves the problem, but geemap currently has a dependency of <=0.13.3

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@nanodan Thanks for reporting. I temporarily set the ipyleaflet dependency of <=0.13.3 because ipyleaflet >0.13.4 has some installation issues on Windows. See jupyter-widgets/ipyleaflet#769. I will remove the dependency version once the issue gets resolved.

from geemap.

nanodan avatar nanodan commented on July 17, 2024

@giswqs Thanks for the quick update. I can get leaflet widgets to display with 0.13.6 (I'm on windows and had no problems installing). I tried to fork geemap and fix ipyleaflet to 0.13.6 but it seems that once ipyevents gets installed, which is one of the dependencies, it breaks leaflet for some reason... Downgrading ipyevents to 0.8.0 doesn't help. If I remove ipyevents and rebuild jupyterlab then I can display widgets again... though now ipyevents is showing up as both enabled/uninstalled at the same time... and of course it is a requirement, so I'm not entirely sure what the actual problem is.

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@nanodan I just tested the pip installation of ipyelaflet with a fresh conda env, it still does not work. The installation went fine, but it throws an error relates the the shapely dependency. Long story short, ipyleaflet >0.13.3 only works on Windows with conda install but not with pip install.

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@nanodan Thanks for providing the solution. Hope it will be helpful for Windows users.

from geemap.

robmarkcole avatar robmarkcole commented on July 17, 2024

Having run

jupyter nbextension install --py --symlink --sys-prefix ipyleaflet
jupyter nbextension enable --py --sys-prefix ipyleaflet

The error is cleared but the notebook hangs on Loading widget... Any advice?
Noting I am using a jupyter docker image (jupyter/scipy-notebook:latest) but I dont think this should compound the underlying issue

from geemap.

giswqs avatar giswqs commented on July 17, 2024

@jpwhitney Thanks for sharing your solution! The other potential solution is to use Windows Subsystem for Linux. I have not tested it yet, but I think WSL could be useful for installing those packages that are very challenging to install on Windows.

from geemap.

OfirMazor avatar OfirMazor commented on July 17, 2024

I want to share my experience with the same error: "Error displaying widget: model not found" .
After upgrading to Jupyterlab 3, for some reason, I had to reinstall all of my lab extensions. Only after I installed Ipyevents extension the problam was fixed.

using:
windows 10
Anaconda navigator

from geemap.

giswqs avatar giswqs commented on July 17, 2024

You can also use the geemap Binder JupyterLab environment: https://gishub.org/geemap-lab
See the environment.yml.

from geemap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.