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

Issue importing proplot #454

Open
chfite opened this issue Mar 26, 2024 · 5 comments
Open

Issue importing proplot #454

chfite opened this issue Mar 26, 2024 · 5 comments

Comments

@chfite
Copy link

chfite commented Mar 26, 2024

I have received the following error when trying to import proplot. I have tried switching to prior versions of the "packaging" module (with no luck) since it seems to have an issue with that in cartopy when proplot is imported. Is this a proplot issue, cartopy issue, or some other issue? Any advice on how to fix it?

proplot version is 0.9.7
cartopy version is 0.22.0
packing versions 21.3 up to 24.0 have been tested
matplotlib version 3.4.3
python version is 3.9

In [1]: import proplot
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 import proplot

File ~/anaconda3/envs/cf3/lib/python3.9/site-packages/proplot/__init__.py:38
     36     from .colors import *  # noqa: F401 F403
     37 with _benchmark('ticker'):
---> 38     from .ticker import *  # noqa: F401 F403
     39 with _benchmark('scale'):
     40     from .scale import *  # noqa: F401 F403

File ~/anaconda3/envs/cf3/lib/python3.9/site-packages/proplot/ticker.py:18
     16 try:
     17     import cartopy.crs as ccrs
---> 18     from cartopy.mpl.ticker import (
     19         _PlateCarreeFormatter, LatitudeFormatter, LongitudeFormatter
     20     )
     21 except ModuleNotFoundError:
     22     ccrs = None

File ~/anaconda3/envs/cf3/lib/python3.9/site-packages/cartopy/mpl/ticker.py:13
     10 import numpy as np
     12 import cartopy.crs as ccrs
---> 13 from cartopy.mpl.geoaxes import GeoAxes
     16 class _PlateCarreeFormatter(Formatter):
     17     """
     18     Base class for formatting ticks on geographical axes using a
     19     rectangular projection (e.g. Plate Carree, Mercator).
     20 
     21     """

File ~/anaconda3/envs/cf3/lib/python3.9/site-packages/cartopy/mpl/geoaxes.py:43
     41 import cartopy.mpl.contour
     42 import cartopy.mpl.feature_artist as feature_artist
---> 43 import cartopy.mpl.geocollection
     44 import cartopy.mpl.patch as cpatch
     45 from cartopy.mpl.slippy_image_artist import SlippyImageArtist

File ~/anaconda3/envs/cf3/lib/python3.9/site-packages/cartopy/mpl/geocollection.py:13
      9 import numpy.ma as ma
     10 import packaging
---> 13 _MPL_VERSION = packaging.version.parse(mpl.__version__)
     16 def _split_wrapped_mesh_data(C, mask):
     17     """
     18     Helper function for splitting GeoQuadMesh array values between the
     19     pcolormesh and pcolor objects when wrapping.  Apply a mask to the grid
     20     cells that should not be plotted with each method.
     21 
     22     """

AttributeError: module 'packaging' has no attribute 'version'
@julian-belina
Copy link

Have you tried downgrading cartopy? The error seems to be in this library

@chfite
Copy link
Author

chfite commented May 8, 2024

@julian-belina I ended up following the direction of #450 which identifies this issue. @riley-brady mentions there he got a similar version error when importing proplot. Seems like it's all tied to incompatibility with newer matplotlib versions? I guess I am still not sure how this all ties back to the cartopy error above, but I am no developer by any means. I ran pip install git+https://github.com/proplot-dev/proplot.git and it seems that it downgraded my matplotlib to 3.5.3 and my proplot to 0.9.5, and things at least appear to be working for now...hopefully a full resolution is found for future versions.

@cvanelteren
Copy link

A solution is being worked on #459

@cvanelteren
Copy link

Fixed with #459 (comment)

@riley-brady
Copy link

Please see #459! Until this gets merged in and released as an official version, you can install proplot via the following command to have compatibility with modern python versions and modern versions of matplotlib, cartopy, etc.

pip install git+https://github.com/proplot-dev/proplot.git@refs/pull/459/head

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

4 participants