geocompx / geocompy

Geocomputation with Python: an open source book and online resource for getting started in this space
https://py.geocompx.org/
Other
260 stars 47 forks source link

Adding 'cartopy' to requirements #183

Closed michaeldorman closed 11 months ago

michaeldorman commented 1 year ago

Chapter 7 Geographic data I/O isn't rendered, probably because I've added cartopy which wasn't in the requirements, not sure how to fix this, thanks!

Robinlovelace commented 1 year ago

Will have a look..

michaeldorman commented 1 year ago

Thanks @Robinlovelace

Robinlovelace commented 1 year ago

It seems like Cartopy is now installed in our Docker container, that was fast: https://github.com/geocompx/docker/actions/runs/5832735777/job/15818734044

Robinlovelace commented 1 year ago

Did that fix it @michaeldorman ?

michaeldorman commented 1 year ago

Yes! :-) Thank you very much @Robinlovelace

michaeldorman commented 1 year ago

I tried adding osmnx using the same method (adding into the environment.yml list), and now once again "Chapter 7 Geographic data I/O" isn't rendered

Robinlovelace commented 1 year ago

To solve this we need to

Robinlovelace commented 1 year ago

Let's see if that fixes it, in around 10 minutes. Hope so!

Robinlovelace commented 1 year ago

Full details from Docker build, I'm impressed at how quick packages install on the vanilla Python Docker image: https://github.com/geocompx/docker/actions/runs/5842426229/job/15843536464#step:8:2006

Robinlovelace commented 1 year ago

Does that fix it @michaeldorman ?

Robinlovelace commented 1 year ago

Looking good!

Robinlovelace commented 1 year ago

image

michaeldorman commented 1 year ago

To solve this we need to

* Add it to requirements.txt, used by https://github.com/geocompx/docker/blob/master/python/Dockerfile

* Rebuild the Docker image

Got it! Thanks @Robinlovelace (How do you rebuild the Docker image?)

michaeldorman commented 1 year ago

Does that fix it @michaeldorman ?

Yes, the chapter is rendered now, thanks!

Robinlovelace commented 1 year ago

(How do you rebuild the Docker image?)

Edit any file in here and commit to the main branch (master) and it will trigger the Docker image rebuild actions.

michaeldorman commented 1 year ago

I think there is a similar issue now with the contextily package, "Chapter 8 Making maps with Python" isn't rendered. The above steps didn't seem to help, will be happy to hear if you have an idea how to solve this, thanks

Robinlovelace commented 1 year ago

Great to see this https://github.com/geocompx/geocompy/commit/477ed27a6cc69b3c07c96b7bea139f6745c32aa8 now just need to rebuild the Docker container.

Robinlovelace commented 1 year ago

This is looking good to me: https://py.geocompx.org/09-mapping

Fixed right @michaeldorman ?

michaeldorman commented 1 year ago

This is looking good to me: https://py.geocompx.org/09-mapping

Fixed right @michaeldorman ?

Yes! Thanks @Robinlovelace

Robinlovelace commented 1 year ago

Great!

michaeldorman commented 11 months ago

I've added the richdem package to environment.yml, then tried to change one of the file to trigger re-building of the Docker image, but the chapter is still not rendered (https://py.geocompx.org/03-spatial-operations.html). I guess I'm missing something about Docker, will appreciate any help @Robinlovelace , thanks

Robinlovelace commented 11 months ago

Sure will take a look..

Robinlovelace commented 11 months ago

Hey @michaeldorman I took a look at the Docker repo but couldn't see any changes. Do you have push access? I just made a change, hopefully the new image will have the richdem package in there and work :crossed_fingers:

https://github.com/geocompx/docker

michaeldorman commented 11 months ago

Thanks @Robinlovelace , I checked and it's not working yet - when I uncomment the richdem code in Chapter 3, the chapter isn't rendered anymore Screenshot from 2023-09-27 00-56-57

Robinlovelace commented 11 months ago

I see.. I now realise that the Docker images use pip as the package manager and use the requirements.txt:

https://github.com/geocompx/docker/blob/master/python/Dockerfile#L11

We need a way to auto update that based on environment.yml.

Currently running

micromamba update -f environment.yml 
Robinlovelace commented 11 months ago

And then

micromamba activate geocompy
conda install pip
pip freeze > requirements.txt

that should be automated..

Robinlovelace commented 11 months ago

Apologies, I now see richdem is in https://github.com/geocompx/geocompy/blob/main/requirements.txt

Robinlovelace commented 11 months ago

Testing locally with

docker pull ghcr.io/geocompx/docker:python
Robinlovelace commented 11 months ago

Underlying problem: installation of richdem failed: https://github.com/geocompx/docker/actions/runs/6317840710/job/17155518300#step:8:2552

Robinlovelace commented 11 months ago

This seems to be a known issue with the package: https://github.com/r-barnes/richdem/issues/65

Robinlovelace commented 11 months ago

Chapter is now back up: https://py.geocompx.org/03-spatial-operations

image

In the long term this is not an ideal solution. If https://github.com/r-barnes/richdem/issues/65 cannot be fixed it may be worth looking at alternatives or mentioning issues with installing the package with pip + Python 3.11.

michaeldorman commented 11 months ago

Thanks for the thorough check @Robinlovelace ! I agree that this is not an ideal situation, if necessary perhaps we can use gdaldem from the command line for this example, or look for other alternatives

Robinlovelace commented 11 months ago

https://gdal.org/programs/gdaldem.html looks like a great solution if it can work, surely there's a Python wrapper?

michaeldorman commented 11 months ago

https://gdal.org/programs/gdaldem.html looks like a great solution if it can work, surely there's a Python wrapper?

I think so, will add an issue so that we remember to check it out

michaeldorman commented 11 months ago

I think this was already completed by @Robinlovelace , so closing

Robinlovelace commented 11 months ago

Thanks for closing this Michael.