0

I am trying to install some libraries like opencv-python and mediapipe in Blender (Windows 10, Blender version 3.0). I have used the following commands to install opencv:

cd [Navigate to where python.exe is in blender folder]

The path is:

C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin

In command prompt I execute the following statement:

python.exe -m pip install opencv-python

This gives me the following message:

Defaulting to user-installation because normal site package is not writeable

I already have anaconda3 (python-spyder installed on my windows system which I am using for other ML work). So is it possible that installation is causing some clashes?

I also tried the following script:

import subprocess
    import sys
    subprocess.check_call([sys.executable, "-m", "ensurepip"])
    subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
    subprocess.check_call([sys.executable,"-m","pip","install","opencv-python"])
    subprocess.check_call([sys.executable,"-m","pip","install","opencv-contrib-python"])
    subprocess.check_call([sys.executable, "-m", "pip", "install", "mediapipe"])

After the script is executed, when I try to import cv2/mediapipe I am getting no module found error.

Any ideas on how I can resolve this issue?

Markus von Broady
  • 36,563
  • 3
  • 30
  • 99
  • 1
    Have you tried this? https://blender.stackexchange.com/questions/56011/how-to-install-pip-for-blenders-bundled-python – Crantisz Feb 16 '22 at 10:00
  • I don't use Anaconda, take a look at this answer which suggests to use conda deactivate twice. However, in case Anaconda is just completely unrelated, try running your command line as an administrator and try installing Blender outside of special folders like Program Files. – Markus von Broady Feb 16 '22 at 10:02
  • Crantisz that was the first thing I looked at,as for markus's suggestion,even after deactivating I am still getting the error – Sparsh Garg Feb 16 '22 at 13:51
  • I was able to get the installations done,apparently I had to use pip --t as mentioned here https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip – Sparsh Garg Feb 16 '22 at 14:13

0 Answers0