Giter VIP home page Giter VIP logo

Comments (20)

Niko-La avatar Niko-La commented on May 16, 2024 3

@deeplook this is great news. @giswqs leafmap would be awesome on pyscript, just in time as the binder builds are now heavy and take a while.

pyscript map html file & demo:
https://github.com/ryanking13/geopandas-pyodide-test/blob/main/index.html
https://ryanking13.github.io/geopandas-pyodide-test/

@ryanking13 thanks for this poc.

from leafmap.

giswqs avatar giswqs commented on May 16, 2024 3

@jtpio Thank you for the suggestion. I have made jupyterlab and ipysheet as optional dependencies, now leafmap can be installed easily using piplite.

Try it out at https://demo.leafmap.org

%pip install -q leafmap
jupyterlite.mp4

from leafmap.

deeplook avatar deeplook commented on May 16, 2024 1

I'm pretty new to this, too. The geojson package which is not preinstalled in JupyterLite can be installed with either of these lines (and the wheel was created in August 2019, see https://pypi.org/project/geojson/#files ;):

await micropip.install("https://files.pythonhosted.org/packages/e4/8d/9e28e9af95739e6d2d2f8d4bef0b3432da40b7c3588fbad4298c1be09e48/geojson-2.5.0-py2.py3-none-any.whl")

await micropip.install("geojson")

There is also this description for creating a Pyodide package, but I need to digest more of it...

And then, I read somewhere in the Pyodide issues on Github (I believe) that micropip will load the wheels using HTTP range requests, which maybe not all servers do support...

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

@deeplook Thanks a lot for looking into this. It would be super awesome to have leafmap run on JupyterLite. Are the source wheels required by micropip the same as the one hosted on PyPI? I just built the pyshp wheel and made it available at https://spatial.utk.edu/download/pyshp-2.1.3-py3-none-any.whl. However, it seems micropip failed to fetch the wheel. I also tried uploading the wheel to JupyterLite and installed it, but it failed as well. Any advice? @jtpio @martinRenou

await micropip.install('https://spatial.utk.edu/download/pyshp-2.1.3-py3-none-any.whl')

ksnip_20210623-131924

await micropip.install('pyshp-2.1.3-py3-none-any.whl')

image

from leafmap.

jtpio avatar jtpio commented on May 16, 2024

Yes it would be interesting to double check installing pyshp from another server.

The content type seems to be differing:

$ curl -i https://spatial.utk.edu/download/pyshp-2.1.3-py3-none-any.whl
HTTP/1.1 200 OK
Date: Wed, 23 Jun 2021 20:53:41 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips
Vary: User-Agent,Accept-Encoding
Last-Modified: Wed, 23 Jun 2021 17:05:46 GMT
ETag: "9190-5c571eaedc79d"
Accept-Ranges: bytes
Content-Length: 37264
Content-Type: application/x-troff-man

and

$ curl -i https://files.pythonhosted.org/packages/e4/8d/9e28e9af95739e6d2d2f8d4bef0b3432da40b7c3588fbad4298c1be09e48/geojson-2.5.0-py2.py3-none-any.whl
HTTP/2 200
last-modified: Wed, 26 Feb 2020 17:59:43 GMT
etag: "183b6f5ccb61818543f29c62a47eff16"
content-type: binary/octet-stream
server: UploadServer
cache-control: max-age=365000000, immutable, public
accept-ranges: bytes
date: Wed, 23 Jun 2021 20:55:48 GMT
age: 1251652
x-served-by: cache-sea4481-SEA, cache-hhn4082-HHN
x-cache: HIT, HIT
x-cache-hits: 1, 1
x-timer: S1624481749.825108,VS0,VE1
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: deny
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-permitted-cross-domain-policies: none
x-robots-header: noindex
access-control-allow-methods: GET
access-control-allow-origin: *
content-length: 14839

from leafmap.

deeplook avatar deeplook commented on May 16, 2024

There is also this pyodide/pyodide#1653 (comment) in pyodide/pyodide#1653 linking such installation issues with coors and specific browser versions.

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

@deeplook This is great to know. Should we wait for JupyterLite to incorporate the latest pyodide?

from leafmap.

jtpio avatar jtpio commented on May 16, 2024

@giswqs @deeplook this PR updates to the latest (dev) version of Pyodide: https://github.com/jtpio/jupyterlite/pull/178

Would you be able to test on the RTD preview? https://jupyterlite--178.org.readthedocs.build/en/178/_static/lab/index.html

from leafmap.

deeplook avatar deeplook commented on May 16, 2024

@jtpio Sorry, but I seem to wait forever to import micropip there.

from leafmap.

jtpio avatar jtpio commented on May 16, 2024

Ah, probably something that changed in pyodide?

from leafmap.

RandomFractals avatar RandomFractals commented on May 16, 2024

well, I got it to work with a custom leaflet map renderer in vscode: https://github.com/RandomFractals/vscode-leaflet#pyolite-notebook-example

only using Pyolite to load geoJSON tho :(

from leafmap.

Niko-La avatar Niko-La commented on May 16, 2024

anyone get leafmap to install via pywheel or micro on jupyterlite. this would be great to skip the binder builds. I believe lot of new features are coming in pyodide that should make it easier.

from leafmap.

deeplook avatar deeplook commented on May 16, 2024

@giswqs Meanwhile it is possible to run geopandas, shapely, fiona and gdal inside pyodide, which seems like providing a big step further in running more of leafmap inside the browser! See pyodide/pyodide#1569 and pyodide/pyodide#3213 (with a test using pyscript in the comments of the latter).

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

@deeplook This is awesome! I will look into it this weekend. PR is also welcome!

from leafmap.

ryanking13 avatar ryanking13 commented on May 16, 2024

@ryanking13 thanks for this poc.

Glad to hear that it was helpful :)

Please don't hesitate to ping me or open an issue in Pyodide if you have any help or find a bug in using geopandas in Pyodide.

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

I tried to install leafmap with piplite. It seems there are several dependencies that do not have a wheel, such as gdown, pycrs. Let me see if I can build the missing wheels.

image
image

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

I was able to build wheels for gdown and pycrs. However, the other three dependencies (tornado, pyzmq, and argon2-cffi-binders) do not have noarch wheels. piplite does not accept noarch wheels. Any advice?

await piplite.install('https://giswqs.github.io/py-wheels/gdown-4.5.3-py3-none-any.whl')
await piplite.install('https://giswqs.github.io/py-wheels/PyCRS-1.0.2-py3-none-any.whl')

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

tornado, pyzmq, and argon2-cffi-binders appear to be dependencies of notebook. I might need to create a leafmap-lite package without the notebook dependency.

image

from leafmap.

giswqs avatar giswqs commented on May 16, 2024

I created a new package called leafmap-lite without the jupyterlab and ipysheet dependencies (they require tonado, which can't be installed in jupyterlite yet). Excited to see leafmap finally works with JupyterLite.

https://giswqs.github.io/leafmap-jupyterlite

import piplite
await piplite.install('leafmap-lite')
await piplite.install('leafmap', deps=False)

Peek 2022-11-23 18-38

from leafmap.

jtpio avatar jtpio commented on May 16, 2024

Really nice!

without the jupyterlab and ipysheet dependencies (they require tonado, which can't be installed in jupyterlite yet)

Is there any reason to depend on jupyterlab? Usually widgets don't need that dependency. For ipysheet probably the same could be done (trimming dependencies).

from leafmap.

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.