Copulas
Copulas copied to clipboard
Error importing copulas.visualization due to removal of checkdep_ghostscript in matplotlib>=3.3.0
Environment Details
Please indicate the following details about the environment in which you found the bug:
- Copulas version: 0.5.0
- Python version: 3.8.5
- Operating System: Windows 10
Error Description
Trying to import copulas with matplotlib==3.3.4
,
which doesn't succeed due to ImportError.
It seems like matplotlib has removed checkdep_ghostscript
required for matplotlib.use('PS')
starting from matplotlib>=3.3.0
https://github.com/matplotlib/matplotlib/blob/7303d81eb2390208d3bac67dd51d390b585e411f/doc/api/prev_api_changes/api_changes_3.3.0/removals.rst
Steps to reproduce
from copulas.bivariate import Clayton
from copulas.visualization import compare_3d
returns traceback:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-82-b1eb6fe857f6> in <module>
12 # Copulas sdv-dev/Copulas
13 from copulas.bivariate import Clayton
---> 14 from copulas.visualization import compare_3d
C:\ProgramData\Anaconda3\lib\site-packages\copulas\visualization.py in <module>
3 from mpl_toolkits import mplot3d # noqa: importing this fixes import error in py35
4
----> 5 matplotlib.use('PS') # Avoid crash on macos
6 import matplotlib.pyplot as plt # noqa isort:skip
7
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py in use(backend, force)
1169 If True, initialize with default parameters before updating with those
1170 in the given file. If False, the current configuration persists
-> 1171 and only the parameters specified in the file are updated.
1172
1173 """
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py in switch_backend(newbackend)
274 return matplotlib.is_interactive()
275
--> 276
277 def ioff():
278 """Turn the interactive mode off."""
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py in backend_mod()
275
276
--> 277 def ioff():
278 """Turn the interactive mode off."""
279 matplotlib.interactive(False)
C:\ProgramData\Anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_ps.py in <module>
19
20 import matplotlib as mpl
---> 21 from matplotlib import (
22 cbook, _path, __version__, rcParams, checkdep_ghostscript)
23 from matplotlib.backend_bases import (
ImportError: cannot import name 'checkdep_ghostscript' from 'matplotlib' (C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py)