PyImageSearch / imutils

A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
MIT License
4.54k stars 1.03k forks source link

No module named 'imutils' after pip install #24

Closed benstadin closed 7 years ago

benstadin commented 7 years ago

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'
saschwarz commented 7 years ago

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

FariborzN commented 7 years ago

@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/countframes.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

radhikatv commented 6 years ago

I am trying to install imutils using : conda install -c mlgill imutils

and I get the below error

Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:

jrosebr1 commented 6 years ago

The imutils library is a non-conda package. You need to install via pip. See this thread for more details: https://github.com/jrosebr1/imutils/issues/36

radhikatv commented 6 years ago

Hi Adrian

Thank you. I executed the below. imutils is installed and I can see it in Conda list from the Terminal. However, when I try to look for the package in interpreter of Pycharm Edu, I don't see it.

conda install pip pip install imutils

Regards, Radhika

On 22 January 2018 at 03:39, Adrian Rosebrock notifications@github.com wrote:

The imutils library is a non-conda package. You need to install via pip. See this thread for more details: #36 https://github.com/jrosebr1/imutils/issues/36

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jrosebr1/imutils/issues/24#issuecomment-359399161, or mute the thread https://github.com/notifications/unsubscribe-auth/AgDNXjb-K1IkJQRKGbnTkYkE1Uc0NJwLks5tNHOKgaJpZM4M61sE .

jrosebr1 commented 6 years ago

Try setting the Project Interpreter from your PyCharm settings to point to your conda install or associated Python virtual environment.

iamjadhav commented 6 years ago

Hey @jrosebr1 . I am using Anaconda(spyder) for image processing and was trying the ball tracking blog from your site. I wanted to install imutils and used the command pip install imutils. I can see imutils in the list but when i try to run the program again , it shows 'no module found' again. Please me help with this.

jrosebr1 commented 6 years ago

Are you referring to the Spyder IDE? You'll need to set the project interpreter for Spyder. I don't use Spyder so I'm not sure how to do this, but for PyCharm take a look at this tutorial:

https://www.pyimagesearch.com/2015/08/17/the-perfect-computer-vision-environment-pycharm-opencv-and-python-virtual-environments/

Personally, I like executing my scripts via command line. If you're having problems executing via your IDE you can always revert to terminal.

iamjadhav commented 6 years ago

Thanks ! Will use Pycharm now.

ANTZ314 commented 6 years ago

Hey guys I tried the uninstall method and re-installed from both within and outside the (cv) environment and still getting the "no module named imutils" error? Any suggestions. I've never had this problem previously.

jrosebr1 commented 6 years ago

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
HongChow commented 6 years ago

How to fix that? @jrosebr1

jrosebr1 commented 6 years ago

@HongChow I've answered the question many times in the thread. You'll need to be more specific regarding the exact error you are getting, operating system, and Python environment.

KingfaLuis commented 6 years ago

pip install imutils

markp64 commented 6 years ago

I ran $ sudo pip install imutils then $ python python 3.5.2

import imutils ImportError: No module names 'imutils'

if run $ sudo python Python 2.7.12

import imutils (imports ok)

I had installed imutils in Python2.7 (sudo pip install imutils) and was trying to use it in Python3 (thinking I was in Python2 - PEBKAC)

Firstly, I didn't notice that I was running python3 and then python2 when using sudo. Secondly, I had an alias entry in my .bashrc file causing the confusion: alias python='/usr/bin/python3' Thirdly, have to be aware when using sudo, that it runs in a different user environment. (Try $ env, then $ sudo env ). sudo is not just a security override.

elgarmi09gt commented 5 years ago

Hi Note : The version of python is determine in python Path but version of pip is in python path + Scripts So if you like to install module by pip configure your environment variable and make the right way of pip you like to use and install your module with pip Tks

ellensp commented 5 years ago

you need to reactivate the virtual environment. ie do the following commands source ~/.profile workon cv cd Smart-Security-Camera python main.py

ayanasser commented 5 years ago

Hi all ,

It's installed on python3 perfectly , but when i installed it on python2 it gave me this error

The directory '/home/biohelwan/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already satisfied: imutils in /usr/local/lib/python3.5/dist-packages (0.5.2)

jrosebr1 commented 5 years ago

Delete your .cache directory first and then retry:

$ rm -rf ~/.cache

Mathew3000 commented 5 years ago

Hey, my solution was to install imutils without sudo. I hope it helps someone.

lamoboos223 commented 5 years ago
  1. sudo pip uninstall imutils
  2. sudo pip install imutils
  3. python3
  4. import imutils
  5. if there is no error enter exit()

and congrats it works perfectly

ajaytomgeorge commented 5 years ago

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

rvdrupal commented 4 years ago

try this >> conda install -c conda-forge imutils

amrfodd commented 4 years ago

import pip
pip.main(['install', 'imutils'])

in Jupyter Notebook

TrabelsiRim commented 3 years ago

Python 2.7

pip install imutils or sudo pip install imutils (Raspberry)

Python 3

pip3 install imutils or sudo pip3 install imutils (Raspberry)

SalmanCode commented 3 years ago

Hey guys I tried the uninstall method and re-installed from both within and outside the (cv) environment and still getting the "no module named imutils" error? Any suggestions. I've never had this problem previously.

Hello, did it finaly worked for you. I am having the same issue.