Skip to content Skip to sidebar Skip to footer

Python 2 Import Error: Cannot Import Name Unpack_labeled_data

I m trying to import import numpy as np. This is my code import cv2 from matplotlib import pyplot as plt img = cv2.imread('messi5.jpg',0) plt.imshow(img, cmap = 'gray', interpolat

Solution 1:

I had the same error and fix it just now.My OS is Windows too, so you just need to upgrade your the version of matplotlib.I install matplotlib-1.3.1 result in import error and upgrade it to matplotlib-1.5.1 everything is OK.

Solution 2:

I'm certain this is an installation issue after having installed an older version of matplotlib. Installing a new version of matplotlib on top of the old version did not fix this error for me however.

Edit: I fixed this by running uninstalling matplotlib twice. Matplotlib 1.5.1 was installed on my system, as well as a Matplotlib 1.2.0 egg.

pip uninstall matplotlib
pip uninstall matplotlib
pip install --upgrade matplotlib

Linux

I ended up having to install everything in a virtualenv to get past the error(even though I had the latest version of matplotlib in my system). You may need to install virtualenv via pip or your package manager.

virtualenv -p $(which python2) py2k
source py2k/bin/activate
pip install matplotlib numpy

Windows

you can use conda from Miniconda to install pre-compiled python modules (if you and don't want to got through the hell of pip on Windows)

conda create--name py2k python=2
activate py2k
conda install matplotlib numpy

You can also just use Anaconda which has matplotlib and numpy bundled in the Python 2 interpreter.

Post a Comment for "Python 2 Import Error: Cannot Import Name Unpack_labeled_data"