ImportError: cannot import name 'get_versions' from 'matplotlib._version'

Viewed 180

When doing my imports:

import cv2
from matplotlib import pyplot as plt
import numpy as np
import opencv_wrapper as cvw

I get:

ImportError                               Traceback (most recent call last)
/var/folders/bw/fb7g3vhj2ln41zrg3v5ynnn40000gn/T/ipykernel_96862/883562467.py in <module>
      1 # import the necessary packages
      2 import cv2
----> 3 from matplotlib import pyplot as plt
      4 import numpy as np
      5 import opencv_wrapper as cvw

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/__init__.py in <module>
    114 # Get the version from the _version.py versioneer file. For a git checkout,
    115 # this is computed based on the number of commits since the last tag.
--> 116 from ._version import get_versions
    117 __version__ = str(get_versions()['version'])
    118 del get_versions

ImportError: cannot import name 'get_versions' from 'matplotlib._version' (/opt/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/_version.py)

I'm using: matplotlib 3.4.3 numpy 1.16.2 opencv-python 4.0.0.21 opencv-wrapper 0.2.3 python 3.7.13

Due to the opencv wrapper these are the versions I need to use.

I've tried to uninstall and reinstall but the error persists. Any help will be appreciated.

0 Answers
Related