alyssaq / face_morpher

:angel: Morph faces with Python, Numpy, Scipy
882 stars 233 forks source link

No module named 'cv2' #51

Closed Tanath closed 5 years ago

Tanath commented 5 years ago

Using Linux. I've tried the extra/opencv 4.0.1-5 package and opencv2 2.4.13.6-1 but I still get this:

pip install --user -r requirements.txt:


Requirement already satisfied: scipy in /usr/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (1.2.1)
Requirement already satisfied: matplotlib in /usr/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (3.0.2)
Requirement already satisfied: docopt in /usr/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (0.6.2)
Collecting stasm (from -r requirements.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/32/f5/3d7cecf2b85bb56bf621e434217f62f814c163c938aa199c7db64b6594ee/stasm-2.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-5whudbkb/stasm/setup.py", line 38, in <module>
        from cv2 import __version__ as cv_ver
    ModuleNotFoundError: No module named 'cv2'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-5whudbkb/stasm/```
alyssaq commented 5 years ago

You could try starting a python shell and running import cv2. If it fails then you'll have to fix your opencv installation.

Tanath commented 5 years ago

What makes you think there's something wrong with the package I installed? I just noticed this: Using python (Python 3):

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'

Using python2:

>>> import cv2
>>> 

I have pip and pip3, both of which use python 3. No pip2.

Tanath commented 5 years ago

I found a python2-pip repo package which enabled me to pip2 install --user -r requirements.txt successfully.

Now when I run python2 ./facemorpher/averager.py --images=../gf --out=average.png I get:

Traceback (most recent call last):
  File "facemorpher/averager.py", line 32, in <module>
    from facemorpher import locator
ImportError: No module named facemorpher

Edit: Sorry, it's been a bit and I forgot to now pip2 install --user facemorpher. I have a different error now: OpenCV Error: Unsupported format or combination of formats but I think I can close this one.