conda-forge / cartopy-feedstock

A conda-smithy repository for cartopy.
BSD 3-Clause "New" or "Revised" License
4 stars 16 forks source link

also require sciypy again? #99

Closed mathause closed 3 years ago

mathause commented 3 years ago

Issue: I just tested the new cartopy v0.18.0 py39h32a4312_6. Thanks for adding matplotlib again. However, this does still not seem to be the minimum required packages to create a map/ figure. It at least scipy is also required. So I wonder if scipy should also be added back.

conda create -n cartopy_raw cartopy ipython
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
ax = plt.axes(projection=ccrs.PlateCarree())
ModuleNotFoundError: No module named 'scipy'

Full traceback

```python-traceback --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in ----> 1 ax = plt.axes(projection=ccrs.PlateCarree()) ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/matplotlib/pyplot.py in axes(arg, **kwargs) 962 963 if arg is None: --> 964 return subplot(111, **kwargs) 965 else: 966 return gcf().add_axes(arg, **kwargs) ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/matplotlib/pyplot.py in subplot(*args, **kwargs) 1140 1141 fig = gcf() -> 1142 ax = fig.add_subplot(*args, **kwargs) 1143 bbox = ax.bbox 1144 axes_to_delete = [] ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs) 1386 args = tuple(map(int, str(args[0]))) 1387 projection_class, kwargs, key = \ -> 1388 self._process_projection_requirements(*args, **kwargs) 1389 ax = self._axstack.get(key) # search axes with this key in stack 1390 if ax is not None: ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/matplotlib/figure.py in _process_projection_requirements(self, polar, projection, *args, **kwargs) 1104 projection_class = projections.get_projection_class(projection) 1105 elif hasattr(projection, '_as_mpl_axes'): -> 1106 projection_class, extra_kwargs = projection._as_mpl_axes() 1107 kwargs.update(**extra_kwargs) 1108 else: ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/cartopy/crs.py in _as_mpl_axes(self) 183 184 def _as_mpl_axes(self): --> 185 import cartopy.mpl.geoaxes as geoaxes 186 return geoaxes.GeoAxes, {'map_projection': self} 187 ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/cartopy/mpl/geoaxes.py in 48 import cartopy.mpl.patch as cpatch 49 from cartopy.mpl.slippy_image_artist import SlippyImageArtist ---> 50 from cartopy.vector_transform import vector_scalar_to_grid 51 52 ~/conda/envs/cartopy_raw/lib/python3.9/site-packages/cartopy/vector_transform.py in 24 25 import numpy as np ---> 26 from scipy.interpolate import griddata 27 28 ModuleNotFoundError: No module named 'scipy' ```


Environment (conda list):

``` $ conda list # packages in environment at /home/mathause/conda/envs/cartopy_raw: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 1_gnu conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.1 py_0 conda-forge c-ares 1.17.1 h36c2ea0_0 conda-forge ca-certificates 2020.12.5 ha878542_0 conda-forge cartopy 0.18.0 py39h32a4312_6 conda-forge certifi 2020.12.5 py39hf3d152e_0 conda-forge cycler 0.10.0 py_2 conda-forge decorator 4.4.2 py_0 conda-forge freetype 2.10.4 he06d7ca_0 conda-forge geos 3.8.1 he1b5a44_0 conda-forge ipython 7.19.0 py39hef51801_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jedi 0.17.2 py39hf3d152e_1 conda-forge jpeg 9d h516909a_0 conda-forge kiwisolver 1.3.1 py39h081fc7a_0 conda-forge krb5 1.17.2 h926e7f8_0 conda-forge lcms2 2.11 hcbb858e_1 conda-forge ld_impl_linux-64 2.35.1 hed1e6ac_1 conda-forge libblas 3.9.0 3_openblas conda-forge libcblas 3.9.0 3_openblas conda-forge libcurl 7.71.1 hcdd3856_8 conda-forge libedit 3.1.20191231 he28a2e2_2 conda-forge libev 4.33 h516909a_1 conda-forge libffi 3.3 h58526e2_2 conda-forge libgcc-ng 9.3.0 h5dbcf3e_17 conda-forge libgfortran-ng 7.5.0 hae1eefd_17 conda-forge libgfortran4 7.5.0 hae1eefd_17 conda-forge libgomp 9.3.0 h5dbcf3e_17 conda-forge liblapack 3.9.0 3_openblas conda-forge libnghttp2 1.41.0 h8cfc5f6_2 conda-forge libopenblas 0.3.12 pthreads_hb3c22a3_1 conda-forge libpng 1.6.37 hed695b0_2 conda-forge libssh2 1.9.0 hab1572f_5 conda-forge libstdcxx-ng 9.3.0 h2ae2ef3_17 conda-forge libtiff 4.2.0 hdc55705_0 conda-forge libwebp-base 1.1.0 h516909a_3 conda-forge lz4-c 1.9.2 he1b5a44_3 conda-forge matplotlib-base 3.3.3 py39h98787fa_0 conda-forge ncurses 6.2 h58526e2_4 conda-forge numpy 1.19.4 py39hdbf815f_2 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge openssl 1.1.1i h7f98852_0 conda-forge parso 0.7.1 pyh9f0ad1d_0 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py39hde42818_1002 conda-forge pillow 8.0.1 py39h397ff4d_0 conda-forge pip 20.3.3 pyhd8ed1ab_0 conda-forge proj 7.1.1 h966b41f_3 conda-forge prompt-toolkit 3.0.8 pyha770c72_0 conda-forge ptyprocess 0.6.0 py_1001 conda-forge pygments 2.7.3 pyhd8ed1ab_0 conda-forge pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pyshp 2.1.2 pyh9f0ad1d_0 conda-forge python 3.9.1 hffdb5ce_1_cpython conda-forge python-dateutil 2.8.1 py_0 conda-forge python_abi 3.9 1_cp39 conda-forge readline 8.0 he28a2e2_2 conda-forge setuptools 49.6.0 py39h079e4ff_2 conda-forge shapely 1.7.1 py39hfa2dc8b_1 conda-forge six 1.15.0 pyh9f0ad1d_0 conda-forge sqlite 3.34.0 h74cdb3f_0 conda-forge tk 8.6.10 hed695b0_1 conda-forge tornado 6.1 py39hbd71b63_0 conda-forge traitlets 5.0.5 py_0 conda-forge tzdata 2020d h516909a_0 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge wheel 0.36.2 pyhd3deb0d_0 conda-forge xz 5.2.5 h516909a_1 conda-forge zlib 1.2.11 h516909a_1010 conda-forge zstd 1.4.5 h6597ccf_2 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info ```
xylar commented 3 years ago

@mathause, adding back scipy seems like a reasonable thing to do given your test. Not much use having matplotlib if you can't even create a GeoAxis without scipy. I've done this in #100 and also added your simple test. Thanks for the suggestion. Sorry for the trouble.

I'm still a little confused about the requirements from upstream. gdal, pillow, matplotlib and scipy are all lumped under "plotting" but it seems gdal and presumably pillow are not as strictly required as the other two?

mathause commented 3 years ago

Thanks for the fast reply. Adding scipy allows to create an axes and to do pcolormesh and contour plots. So that ticks the boxes I need. However, I don't know the inner workings of cartopy so I cannot advise on the other dependencies. Maybe @QuLogic or @dopplershift could weigh in?

dopplershift commented 3 years ago

Well, while scipy is documented as optional, there's two places where scipy is unconditionally imported (one as a fallback for pykdtree). So decidedly incorrect to treat it as optional--anybody who doesn't have scipy is unable to import cartopy.