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

ImportError during launch #66

Open
marcowurth opened this issue Jul 4, 2024 · 1 comment
Open

ImportError during launch #66

marcowurth opened this issue Jul 4, 2024 · 1 comment

Comments

@marcowurth
Copy link

Hi, I just installed psy-view on Linux via my miniconda:
conda create -n psyplot -c conda-forge --override-channels psy-view

After then typing psy-view launching fails due to an import error in psy-simple with a matplotlib method:

(psyplot) 14:30 ~/Documents/stuff $psy-view
Traceback (most recent call last):
File "/home/marcowurth/miniconda3/envs/psyplot/bin/psy-view", line 11, in
sys.exit(main())
^^^^^^
File "/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/psy_view/init.py", line 161, in main
start_app(ds, args.name, args.plotmethod, args.preset)
File "/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/psy_view/init.py", line 70, in start_app
from psy_view.ds_widget import DatasetWidgetStandAlone
File "/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/psy_view/ds_widget.py", line 42, in
from psy_view.plotmethods import (
File "/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/psy_view/plotmethods.py", line 37, in
import psy_simple.widgets.colors as pswc
File "/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/psy_simple/widgets/colors.py", line 30, in
import psy_simple.colors as psc
File "/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/psy_simple/colors.py", line 24, in
from matplotlib.cm import get_cmap as mpl_get_cmap
ImportError: cannot import name 'get_cmap' from 'matplotlib.cm' (/home/marcowurth/miniconda3/envs/psyplot/lib/python3.11/site-packages/matplotlib/cm.py)

I checked the module in question matplotlib/cm.py (matplotlib-base v3.9.0) and it contains the method get_cmap twice, in class ColormapRegistry and in ScalarMappable. Hope this helps.

@marcowurth
Copy link
Author

Update: matplotlib.cm.get_cmap is deprecated since v3.7. Seems straight-forward to replace your get_cmap calls with the newer matplotlib.colormaps[name], so that psy-view works with newer matplotlib versions too.

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

1 participant