Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding 'cartopy' to requirements #183

Closed
michaeldorman opened this issue Aug 11, 2023 · 36 comments
Closed

Adding 'cartopy' to requirements #183

michaeldorman opened this issue Aug 11, 2023 · 36 comments

Comments

@michaeldorman
Copy link
Collaborator

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
Copy link
Contributor

Will have a look..

@michaeldorman
Copy link
Collaborator Author

Thanks @Robinlovelace

@Robinlovelace
Copy link
Contributor

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
Copy link
Contributor

Did that fix it @michaeldorman ?

@michaeldorman
Copy link
Collaborator Author

Yes! :-) Thank you very much @Robinlovelace

@michaeldorman
Copy link
Collaborator Author

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

@michaeldorman michaeldorman reopened this Aug 12, 2023
@Robinlovelace
Copy link
Contributor

To solve this we need to

@Robinlovelace
Copy link
Contributor

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

@Robinlovelace
Copy link
Contributor

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
Copy link
Contributor

Does that fix it @michaeldorman ?

@Robinlovelace
Copy link
Contributor

Looking good!

@Robinlovelace
Copy link
Contributor

image

@michaeldorman
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Does that fix it @michaeldorman ?

Yes, the chapter is rendered now, thanks!

@Robinlovelace
Copy link
Contributor

(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
Copy link
Collaborator Author

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

@michaeldorman michaeldorman reopened this Aug 30, 2023
@Robinlovelace
Copy link
Contributor

Great to see this 477ed27 now just need to rebuild the Docker container.

Robinlovelace added a commit to geocompx/docker that referenced this issue Aug 30, 2023
@Robinlovelace
Copy link
Contributor

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

Fixed right @michaeldorman ?

@michaeldorman
Copy link
Collaborator Author

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

Fixed right @michaeldorman ?

Yes! Thanks @Robinlovelace

@Robinlovelace
Copy link
Contributor

Great!

@michaeldorman
Copy link
Collaborator Author

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

@michaeldorman michaeldorman reopened this Sep 26, 2023
@Robinlovelace
Copy link
Contributor

Sure will take a look..

@Robinlovelace
Copy link
Contributor

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 🤞

https://github.com/geocompx/docker

@michaeldorman
Copy link
Collaborator Author

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
Copy link
Contributor

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
Copy link
Contributor

Robinlovelace commented Sep 27, 2023

And then

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

that should be automated..

@Robinlovelace
Copy link
Contributor

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

@Robinlovelace
Copy link
Contributor

Testing locally with

docker pull ghcr.io/geocompx/docker:python

@Robinlovelace
Copy link
Contributor

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

@Robinlovelace
Copy link
Contributor

This seems to be a known issue with the package: r-barnes/richdem#65

@Robinlovelace
Copy link
Contributor

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

image

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

@michaeldorman
Copy link
Collaborator Author

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
Copy link
Contributor

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

@michaeldorman
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

@Robinlovelace
Copy link
Contributor

Thanks for closing this Michael.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants