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

How to add cartopy? #50

Closed
RobertPincus opened this issue Apr 27, 2021 · 11 comments · Fixed by #52
Closed

How to add cartopy? #50

RobertPincus opened this issue Apr 27, 2021 · 11 comments · Fixed by #52

Comments

@RobertPincus
Copy link
Contributor

For making maps in many cases we will want to add the cartopy Python module but simply adding the module to requirements.txt leads to unresolvable dependencies (https://github.com/RobertPincus/how_to_eurec4a/commit/acac4cc2486c9d152415dfbdb2955ee4322a472b). I can't get my local module stack to work with conda - can someone (@d70-t ?) show me how to modify requirements.txt?

(I love that autocorrect wants to change cartopy to "carroty")

@d70-t
Copy link
Collaborator

d70-t commented Apr 27, 2021

Yes, I was fearing that at some point we really want to have cartopy... I just closed #11 because I don't have a really good solution on how to do that.

The problem is that one can not "just" install cartopy via pip. As per their docs one has to install quite some dependencies before installing via pip. This makes the whole book more complicated to run on someones computer. I basically see two options:

  • install dependencies via apt etc... on the continuous integrations machines and the binder environment before running the things -> users / authors would need to install cartopy dependencies manually on their machines prior to be able to compile the book
  • pull in conda as a dependency and install cartopy via conda -> users / authors would need to have conda running on their machines

I personally never got used to conda but others may not be used to installing things manually... Do you have more ideas or preferences?

@RobertPincus
Copy link
Contributor Author

Well, I use conda to manage environments in other CI situations (https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/continuous-integration.yml#L112).

Though using conda will also take some fussing - when I tried to set up a conda environment by just installing 'jupyter and the modules in requirements I got derailed because somehow one jupyter module was being called from the system and not the venv. I could maybe get this worked out.

Or we could make a container? https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml#L10, https://github.com/earth-system-radiation/containers

@d70-t
Copy link
Collaborator

d70-t commented Apr 27, 2021

I am actually not worried too much of getting it to work within CI or binder. There's e.g. hackathon_env which properly sets up a binder environment (or docker image using repo2docker) which includes cartopy.

I am more worried of how to expain and maintain that explanation to someone who follows running locally > via git.

@d70-t
Copy link
Collaborator

d70-t commented Apr 27, 2021

Maybe we could also do a setup like it is described here on stackoverflow, i.e.: make a conda environment which includes the requirements.txt. That way we could keep a single source of information, but give a choice to users if they want to install via conda or via pip?

@RobertPincus
Copy link
Contributor Author

It's great if we have a way for users of conda to run the book. But then how do we support users of pip?

@d70-t
Copy link
Collaborator

d70-t commented Apr 27, 2021

Well, if you want to run cartopy via pip you only have the option to install its dependencies manually... But chances are high that people already did that on their machines as cartopy is quite a common thing. And if cartopy should already be installed on someones machine, pip shouldn't complain during the installation.

That said, we would still need to explain the installation of cartopy in the pip case, as for some, pip install -r requirements.txt will fail.

@RobertPincus
Copy link
Contributor Author

I made a conda environment.yml file that works locally (installs everything from requirements.txt plus cartopy in a conda environment, https://github.com/RobertPincus/how_to_eurec4a/tree/add-p3-examples) but I don't have the CI right yet

@RobertPincus
Copy link
Contributor Author

Indeed I'm quite confused, @d70-t . Documentation suggests that the environment I create will be activate in later steps but conda info shows no environment active (https://github.com/RobertPincus/how_to_eurec4a/runs/2449453339?check_suite_focus=true) and both conda activate how_to_eureca and the equivalent source activate command fail.

Otherwise I would be ready to add examples from the P-3...

@d70-t
Copy link
Collaborator

d70-t commented Apr 27, 2021

Hmm, I probably can look into it tomorrow, but I have to admit, that I never really used conda, so maybe I'll have a hard time on this.

@RobertPincus
Copy link
Contributor Author

I will also keep working... but it doesn't seem to be a problem with the conda installation but rather that the virtual environment isn't being invoked

@RobertPincus
Copy link
Contributor Author

@d70-t Got it... it helps to follow directions

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

Successfully merging a pull request may close this issue.

2 participants