nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
91 stars 46 forks source link

ModuleNotFoundError: No module named 'imutils' #55

Closed majurgens closed 3 years ago

majurgens commented 4 years ago

Hi

I've followed all the instructions on your module page and did not get any errors. I went to run encode.py and I get:

Traceback (most recent call last):
  File "encode.py", line 5, in <module>
    from imutils import paths
ModuleNotFoundError: No module named 'imutils'

I found some other similar post in the forum but they are slightly different and I don't really know anything about python so I'm not really sure how the import system works and why it can't find imutils.

Is there a particular version of python you need. From the forum I saw someone was running python 3.7. I also have python 2.7.16 and python3 v3.7.3

If I pip uninstall imutils, it seems to want to remove it from /home/pi/.local/lib/python2.7/site-packages/imutils/. This does not quite seem right.

I went through the install again and used pip3 instead of pip eg pip3 install COMPONENT and now it works.

I think this is a documentation issue

majurgens commented 4 years ago

I think I might have resolved this with the last pull since I updated the documentation around pip vs pip3 - can you please check what I have written and if it makes sense close this issue?

nischi commented 4 years ago

Which pull do you mean?

majurgens commented 4 years ago

The one that you just approved and where I updated the documentation

nischi commented 4 years ago

hmm i think this is not 100% correct what you written there. pip is for phyton 2 and pip is for python 3 as i know. so if you have installed python 3 you should use pip3. so maybe you change the text a little bit?

majurgens commented 4 years ago

I'm pretty sure that it is correct. I installed a Fedora machine that did not have pip installed and only had python3 installed. After installing python3-pip, the pip command was available and was the same as pip3

[user@testmachine ~]# pip
-bash: pip: command not found
[user@testmachine ~]# pip3
-bash: pip3: command not found
[user@testmachine ~]# dnf install python3-pip
Fedora 32 openh264 (From Cisco) - x86_64                                                                                            1.3 kB/s | 986  B     00:00    
Fedora Modular 32 - x86_64                                                                                                          4.7 kB/s | 3.6 kB     00:00    
Fedora Modular 32 - x86_64 - Updates                                                                                                5.0 kB/s | 3.6 kB     00:00    
Fedora Modular 32 - x86_64 - Updates                                                                                                346 kB/s | 600 kB     00:01    
Fedora 32 - x86_64 - Updates                                                                                                        8.1 kB/s | 4.2 kB     00:00    
Fedora 32 - x86_64 - Updates                                                                                                        5.5 MB/s |  11 MB     00:01    
Fedora 32 - x86_64                                                                                                                  4.7 kB/s | 3.6 kB     00:00    
Dependencies resolved.
====================================================================================================================================================================
 Package                                     Architecture                      Version                                     Repository                          Size
====================================================================================================================================================================
Installing:
 python3-pip                                 noarch                            19.3.1-3.fc32                               updates                            1.7 M
Installing weak dependencies:
 libxcrypt-compat                            x86_64                            4.4.16-1.fc32                               fedora                              99 k

Transaction Summary
====================================================================================================================================================================
Install  2 Packages

Total download size: 1.8 M
Installed size: 8.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): libxcrypt-compat-4.4.16-1.fc32.x86_64.rpm                                                                                    521 kB/s |  99 kB     00:00    
(2/2): python3-pip-19.3.1-3.fc32.noarch.rpm                                                                                         4.9 MB/s | 1.7 MB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                               1.0 MB/s | 1.8 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                            1/1 
  Installing       : libxcrypt-compat-4.4.16-1.fc32.x86_64                                                                                                      1/2 
  Installing       : python3-pip-19.3.1-3.fc32.noarch                                                                                                           2/2 
  Running scriptlet: python3-pip-19.3.1-3.fc32.noarch                                                                                                           2/2 
  Verifying        : python3-pip-19.3.1-3.fc32.noarch                                                                                                           1/2 
  Verifying        : libxcrypt-compat-4.4.16-1.fc32.x86_64                                                                                                      2/2 

Installed:
  libxcrypt-compat-4.4.16-1.fc32.x86_64                                               python3-pip-19.3.1-3.fc32.noarch                                              

Complete!
[user@testmachine ~]# pip --version
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
[user@testmachine ~]# pip3 --version
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
[user@testmachine ~]# 
nischi commented 4 years ago

Okay strange. Then i do not understand why it was not working. Maybe another problem. Will keep the issue open for a while. Let see if somebody else has the same issue.

majurgens commented 4 years ago

It was not working originally because I had 2 versions of python installed and when I followed the instructions to use pip, it was using python2 instead of python3.

nischi commented 4 years ago

Ah okay, but still a strange behaviour. I will extend the readme