Solvedimutils No module named 'imutils' after pip install

I just followed this guide here to install OpenCV: http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/

And then followed this guide here: http://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/

I've pip-installed imutils, but keep getting the error below.

sudo pip install imutils
...
Collecting imutils
  Downloading imutils-0.4.2.tar.gz
Installing collected packages: imutils
  Running setup.py install for imutils ... done
Successfully installed imutils-0.4.2
hdmih0445m:shape-detection bstadin$ 

The install seems to be ok, trying to reinstall imutils gives:

Requirement already satisfied: imutils in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

Running a script importing imutils:

python3 detect_shapes.py --image /Users/bstadin/Downloads/image.png
...
Traceback (most recent call last):
  File "detect_shapes.py", line 7, in <module>
    import imutils
ModuleNotFoundError: No module named 'imutils'
27 Answers

✔️Accepted Answer

It looks like you pip installed imutils using python2's pip and so that's why python3 can't import it. You might try: sudo pip3 install imutils

Other Answers:

@for imutlis package
if you got error
uninstall package withsudo pip3 uninstall imutils
and then you see this
Uninstalling imutils-0.4.3:
/usr/local/bin/range-detector
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/DESCRIPTION.rst
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/INSTALLER
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/METADATA
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/RECORD
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/WHEEL
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/metadata.json
/usr/local/lib/python3.5/dist-packages/imutils-0.4.3.dist-info/top_level.txt
/usr/local/lib/python3.5/dist-packages/imutils/init.py
/usr/local/lib/python3.5/dist-packages/imutils/pycache/init.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/contours.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/convenience.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/encodings.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/meta.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/object_detection.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/paths.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/pycache/perspective.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/contours.py
/usr/local/lib/python3.5/dist-packages/imutils/convenience.py
/usr/local/lib/python3.5/dist-packages/imutils/encodings.py
/usr/local/lib/python3.5/dist-packages/imutils/face_utils/init.py
/usr/local/lib/python3.5/dist-packages/imutils/face_utils/pycache/init.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/face_utils/pycache/facealigner.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/face_utils/pycache/helpers.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/face_utils/facealigner.py
/usr/local/lib/python3.5/dist-packages/imutils/face_utils/helpers.py
/usr/local/lib/python3.5/dist-packages/imutils/feature/init.py
/usr/local/lib/python3.5/dist-packages/imutils/feature/pycache/init.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/feature/pycache/factories.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/feature/pycache/gftt.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/feature/pycache/helpers.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/feature/factories.py
/usr/local/lib/python3.5/dist-packages/imutils/feature/gftt.py
/usr/local/lib/python3.5/dist-packages/imutils/feature/helpers.py
/usr/local/lib/python3.5/dist-packages/imutils/io/init.py
/usr/local/lib/python3.5/dist-packages/imutils/io/pycache/init.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/io/pycache/tempfile.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/io/tempfile.py
/usr/local/lib/python3.5/dist-packages/imutils/meta.py
/usr/local/lib/python3.5/dist-packages/imutils/object_detection.py
/usr/local/lib/python3.5/dist-packages/imutils/paths.py
/usr/local/lib/python3.5/dist-packages/imutils/perspective.py
/usr/local/lib/python3.5/dist-packages/imutils/video/init.py
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/init.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/count_frames.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/filevideostream.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/fps.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/pivideostream.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/videostream.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/pycache/webcamvideostream.cpython-35.pyc
/usr/local/lib/python3.5/dist-packages/imutils/video/count_frames.py
/usr/local/lib/python3.5/dist-packages/imutils/video/filevideostream.py
/usr/local/lib/python3.5/dist-packages/imutils/video/fps.py
/usr/local/lib/python3.5/dist-packages/imutils/video/pivideostream.py
/usr/local/lib/python3.5/dist-packages/imutils/video/videostream.py
/usr/local/lib/python3.5/dist-packages/imutils/video/webcamvideostream.py

and then ask you?

Proceed (y/n)?
answer yes(use Y key)
and then use sudo pip3 install --upgrade imutils
if you use python2 use pip insted pip3 for instalation and unistallation

Hey @ANTZ314 -- my guess is that you may have accidentally installed and uninstalled (perhaps multiple times over) the imutils library from your system Python install and your Python virtual environment. Here's the fool-proof method:

$ workon cv
$ pip install imutils
$ python
>>> import imutils

most probably it is getting installed in global and not in local. Check if imutils is in this folder C:\Program Files\Python37\Lib\site-packages

copy paste imutils and imutils-0.5.2.dist-info folder in your local C:\usersid\AppData\Roaming\Python\Python37\site-packages

NB:AppData folder is hidden

or pip install --user imutils