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

Add geoviews as extra optional dependency in setup.py #193

Merged
merged 6 commits into from
Apr 5, 2021

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Mar 30, 2021

List geoviews as an optional dependency in the setup.py file. Also set up travis to install PROJ and GEOS first so that cartopy (a requirement of geoviews) can be installed.

conda create -n icepyx-env -c conda-forge geos pip proj=7.2.0
conda activate icepyx-env
pip install -e .       # install required dependencies first 
pip install -e .[viz]  # install optional dependencies later

Note that PROJ version is pinned to 7.2.0 because PROJ 8.0.0 doesn't seem to be supported by cartopy yet, wait for SciTools/cartopy#1752.

Fixes #177.

References:

@weiji14 weiji14 added the afternoon_contribution This issue should be resolvable in an afternoon or so of work. label Mar 30, 2021
@weiji14 weiji14 added this to the release 0.4.0 milestone Mar 30, 2021
@weiji14 weiji14 self-assigned this Mar 30, 2021
Using conda to install PROJ, so that cartopy can be installed, and therefore geoviews can be installed too!
Perhaps cartopy doesn't work with PROJ 8.0.0 yet?
@JessicaS11
Copy link
Member

Thanks for putting this together, @weiji14! If @icetianli is unable to review, I will do so Friday.

@icetianli
Copy link
Contributor

icetianli commented Apr 2, 2021

Thank you @weiji14 for this PR! I have been trying to install geoviews as extra dependency using the instructions in your comment:

conda create -n icepyx-env -c conda-forge pip proj=7.2.0
conda activate icepyx-env
pip install -e .[viz]

But it keeps showing the following errors about Fiona and Cartopy:

ERROR: Command errored out with exit status 1:
    Complete output (2 lines):
    Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
    A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
fiona/_transform.cpp:606:10: fatal error: 'cpl_conv.h' file not found
  #include "cpl_conv.h"
           ^~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for fiona
  Running setup.py clean for fiona
Failed to build cartopy fiona
ERROR: Could not build wheels for cartopy which use PEP 517 and cannot be installed directly

However, it works perfectly fine if I didn't add pip after conda-forge:

conda create -n icepyx-env -c conda-forge proj=7.2.0
conda activate icepyx-env
pip install -e .[viz]

Any idea why? Or is it just a typo...? Thanks!

@weiji14
Copy link
Member Author

weiji14 commented Apr 3, 2021

Hmm, you're right. This is why it is recommended to install geoviews/cartopy/shapely via conda because doing it via pip is a nightmare (see SciTools/cartopy#738 and SciTools/cartopy#805). But to explain things:

  • The second one works because you're probably installing using the base environment's python/pip and it is picking up some dependencies installed elsewhere (not recommended though).
  • The first one failed (I think) because geos needs to be installed too, and icepyx should try to install a minimum of cartopy 0.18.0 (instead of 0.17.0 which had some build issues). I've pushed commits 6fab434 and 6e0cdd4, so can you try the below and see if things work:
git checkout geoviews-dependency
conda create -n icepyx-env -c conda-forge geos pip proj=7.2.0
conda activate icepyx-env
pip install -e .
pip install -e .[viz]

Just to be clear, the geoviews install problem shouldn't matter to users who do conda install icepyx (as long as we list geoviews as a dependency in https://github.com/conda-forge/icepyx-feedstock/blob/master/recipe/meta.yaml). But users doing pip install icepyx[viz] might face issues of needing to install both PROJ and GEOS first.

setup.py Outdated Show resolved Hide resolved
Co-authored-by: Tian Li <[email protected]>
@icetianli icetianli merged commit feafb2b into development Apr 5, 2021
@icetianli icetianli deleted the geoviews-dependency branch April 5, 2021 12:04
weiji14 added a commit to regro-cf-autotick-bot/icepyx-feedstock that referenced this pull request May 14, 2021
weiji14 added a commit to conda-forge/icepyx-feedstock that referenced this pull request May 14, 2021
* updated v0.4.0

* MNT: Re-rendered with conda-build 3.21.4, conda-smithy 3.10.1, and conda-forge-pinning 2021.05.13.19.15.21

* Add missing required dependencies for v0.4.0

Specifically: backoff, dask, datashader, holoviews, pandas and tqdm

* Include geoviews for plotting interactive geographical maps

Xref icesat2py/icepyx#193

* Include hvplot and intake as runtime dependencies too

Co-authored-by: Wei Ji <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
afternoon_contribution This issue should be resolvable in an afternoon or so of work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geoviews as a dependency given install challenges
3 participants