carlosedubarreto / b3d_mocap_import

addon for blender to import mocap data from tools like easymocap, frankmocap and Vibe
106 stars 14 forks source link

ModuleNotFoundError: cv2 when generating mocap in Blender 2.91 #5

Closed Eydec closed 3 years ago

Eydec commented 3 years ago

cv2 and mediapipe aren't installed in Blender (checked through blender python console), despite mediapipe appearing in pip list -u in console.

Environment: Windows 10

Error message follows

location: :-1 Python: Traceback (most recent call last): File "C:\\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\Mocap_PE_data_import\load_mocap.py", line 1404, in execute import cv2 ModuleNotFoundError: No module named 'cv2'

carlosedubarreto commented 3 years ago

Please try this code. on the script screen

import subprocess
import sys
import os

# path to python.exe
python_exe = os.path.join(sys.prefix, 'bin', 'python.exe')

# upgrade pip
subprocess.call([python_exe, "-m", "ensurepip"])
subprocess.call([python_exe, "-m", "pip", "install", "--upgrade", "pip"])

# install required packages
subprocess.call([python_exe, "-m", "pip", "install", "opencv-python"])

and click run like this : image

Eydec commented 3 years ago

Created a new script, c+p the code you posted, and ran. After it finished, I tried importing video via mediapipe and got the same error.

carlosedubarreto commented 3 years ago

can you run again the code I provided and place here the result that shows on the console? (it must show the instalation log)

Eydec commented 3 years ago

Nothing in the python console,

bpy.ops.text.run_script() In the Info console

carlosedubarreto commented 3 years ago

Oh sorry, I mean this console image

then something like this will show image

Then you run the code again e post here the result, please

Eydec commented 3 years ago

___ Looking in links: c:\Users\AppData\Local\Temp\tmp_09novfa Requirement already satisfied: setuptools in c:\users\appdata\roaming\python\python37\site-packages (39.0.1) Requirement already satisfied: pip in c:\users\appdata\roaming\python\python37\site-packages (21.0.1) Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pip in c:\users\appdata\roaming\python\python37\site-packages (21.0.1) Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: opencv-python in c:\users\appdata\roaming\python\python37\site-packages (4.5.1.48) Requirement already satisfied: numpy>=1.14.5 in c:\program files\blender foundation\blender 2.91\2.91\python\lib\site-packages (from opencv-python) (1.17.5) ___

carlosedubarreto commented 3 years ago

looks like it installed the opencv on your default windows python instalation.

Do this. on windows explorer, go to this address c:\users\appdata\roaming\python\python37\site-packages image

copy the folder "cv2"

and paste it here c:\program files\blender foundation\blender 2.91\2.91\python\lib\site-packages

image

Eydec commented 3 years ago

Tried Generate mocap, got the following error: ___ File "C:\Users\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\Mocap_PE_data_import\load_mocap.py", line 1405, in execute import mediapipe as mp ModuleNotFoundError: No module named 'mediapipe' ___

carlosedubarreto commented 3 years ago

Now click on this button on blender, and put here what show in the console image