geocompx / docker

Dockerfiles for Geocomputation
https://github.com/geocompx/docker/pkgs/container/docker
GNU General Public License v3.0
38 stars 6 forks source link

Use `rocker/geospatial:dev-osgeo` as basis for `qgis` image #37

Closed Robinlovelace closed 1 year ago

Robinlovelace commented 1 year ago

I hit issues with sf installation but this can be worked around following guidance from the Rocker maintainers here: https://github.com/rocker-org/rocker-versioned2/issues/631

Robinlovelace commented 1 year ago

After changes above getting the following error on

docker build qgis
  25 | >>> RUN pip3 install qgis-plugin-manager
  26 |     # to enable the qgis-plugin-manager, add the corresponding path to PATH
  27 |     ENV PATH="/home/rstudio/.local/bin:$PATH"
ERROR: failed to solve: process "/bin/sh -c pip3 install qgis-plugin-manager" did not complete successfully: exit code: 127
benz0li commented 1 year ago

@Robinlovelace FYI b-data's JupyterLab docker stacks provide something similar:

ℹ️ I am referencing this repository in the README's of the above mentioned projects.

What makes these project different:

  1. Multi-arch: linux/amd64, linux/arm64/v8
  2. Base image: Debian instead of Ubuntu
  3. IDE: code-server next to JupyterLab
  4. Just Python – no Conda / Mamba
Robinlovelace commented 1 year ago

Thanks for the heads-up @benz0li, and for the cross-references to this repo. In terms of this issue, it should be fixed by https://github.com/geocompx/docker/pull/39. Regarding the 4 points you mention above, all sound good, especially code-server. As a fan of VS Code, and keeping things simple, I plan to give it a go!

Robinlovelace commented 1 year ago

Giving it a go with:

docker run -it --rm \
  -p 8888:8888 \
  -u root \
  -v "${PWD}/jupyterlab-jovyan":/home/jovyan \
  -e NB_UID=$(id -u) \
  -e NB_GID=$(id -g) \
  -e CHOWN_HOME=yes \
  -e CHOWN_HOME_OPTS='-R' \
  glcr.b-data.ch/jupyterlab/r/geospatial
benz0li commented 1 year ago

Please be aware of

Create home directory

Create an empty directory using docker:

docker run --rm \
  -v "${PWD}/jupyterlab-jovyan":/dummy \
  alpine chown 1000:100 /dummy

It will be bind mounted as the JupyterLab user's home directory and automatically populated on first run.

ℹ️ You may also give it a go at https://demo.jupyter.b-data.ch.

benz0li commented 1 year ago

@Robinlovelace I have extended the JupyterLab R docker stack build chain to base → tidyverse → verse → geospatial → qgisprocess.
👉 There is now image glcr.b-data.ch/jupyterlab/r/qgisprocess, which is also available at https://demo.jupyter.b-data.ch.

Robinlovelace commented 1 year ago

Good stuff, thanks @benz0li! Can you try reproducing the contents of chapter 10 on GIS in this image? Will be a good test: https://r.geocompx.org/gis.html

cc @jannes-m FYI who is working to update that chapter in https://github.com/geocompx/geocompr/pull/968 so things may change.

benz0li commented 1 year ago

Can you try reproducing the contents of chapter 10 on GIS in this image?

After installing some additional packages, I could reproduce the contents of geocompr/10-gis.Rmd.


Because of https://github.com/ariya/phantomjs/issues/15449, one needs to execute

Sys.setenv(QT_QPA_PLATFORM = "phantom")
Sys.setenv(OPENSSL_CONF = "/dev/null")

on newer Linux distros before a mapview::mapshot in order to avoid errors. The output does not look the same as geocompr/figures/09_shortest_route.png, though.
ℹ️ mapview::mapview works just fine.


> webshot::install_phantomjs()
[...]
HTTP request sent, awaiting response... 200 OK
Length: 23415665 (22M) [application/octet-stream]
Saving to: ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’

phantomjs-2.1.1-linux-x86_64.tar 100%[=========================================================>]  22.33M  38.5MB/s    in 0.6s    

2023-05-22 13:47:58 (38.5 MB/s) - ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’ saved [23415665/23415665]

phantomjs has been installed to /home/benz0li/bin
$ which phantomjs
/home/benz0li/bin/phantomjs
$ QT_QPA_PLATFORM=phantom OPENSSL_CONF=/dev/null phantomjs --version
2.1.1
Robinlovelace commented 1 year ago

Fantastic, thanks for testing @benz0li!

https://github.com/rstudio/webshot2 may be better than webshot, the former does not need PhantomJS. Worth switching to that? Possibly...