Repository navigation
Issue importing proplot #454
Copy link
Copy link
Open
Description
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'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
julian-belina commentedon Apr 20, 2024
Have you tried downgrading cartopy? The error seems to be in this library
chfite commentedon 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.gitand 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 commentedon Jul 30, 2024
A solution is being worked on #459
cvanelteren commentedon Aug 16, 2024
Fixed with #459 (comment)
riley-brady commentedon Aug 18, 2024
Please see #459! Until this gets merged in and released as an official version, you can install
proplotvia the following command to have compatibility with modern python versions and modern versions ofmatplotlib,cartopy, etc.