BlendArMocap icon indicating copy to clipboard operation
BlendArMocap copied to clipboard

Cannot install dependencies for Blender installed with Snap

Open NatalieWolfe opened this issue 3 years ago • 2 comments
trafficstars

Software Version
Ubuntu 20.04.4
Blender 3.1.2
Python 3.10.2

When I attempt to install the add-ons deps I get the error message Command '['/snap/blender/2106/3.1/python/bin/python3.10', '-m', 'pip', 'install', 'mediapipe']' returned non-zero exit status 1.. Here is the full console output as well:

$ blender
Read prefs: /home/oz/.config/blender/3.1/config/userpref.blend
BlendArMocap-release - Initializing...
PACKAGE: BlendArMocap-release
binary: /snap/blender/2106/blender
blender version: (3, 1, 2) exe: /snap/blender/2106/3.1/python/bin/python3.10
BlendArMocap-release - Dependencies installed: False
Registing BlendArMocap

Try to access dependencies
Dependency(module='mediapipe', package=None, name=None)
REGISTRATION FAILED: REQUIRED MODULE NOT FOUND
accessing pip installer
/snap/blender/2106/3.1/python/bin/python3.10 -m pip --version
pip 22.0.4 from /home/oz/.local/lib/python3.10/site-packages/pip (python 3.10)
['/snap/blender/2106/3.1/python/bin/python3.10', '-m', 'pip', 'install', '--upgrade', 'pip']
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.10/site-packages (22.0.4)
Try to install: mediapipe
/snap/blender/2106/3.1/python/bin/python3.10 -m pip install mediapipe
/snap/blender/2106/3.1/python/bin/python3.10: No module named pip
INSTALL USING --USER TAG
 Command '['/snap/blender/2106/3.1/python/bin/python3.10', '-m', 'pip', 'install', 'mediapipe']' returned non-zero exit status 1.
/snap/blender/2106/3.1/python/bin/python3.10: No module named pip
accessing pip installer
/snap/blender/2106/3.1/python/bin/python3.10 -m pip --version
pip 22.0.4 from /home/oz/.local/lib/python3.10/site-packages/pip (python 3.10)
['/snap/blender/2106/3.1/python/bin/python3.10', '-m', 'pip', 'install', '--upgrade', 'pip']
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.10/site-packages (22.0.4)
Try to install: mediapipe
/snap/blender/2106/3.1/python/bin/python3.10 -m pip install mediapipe
/snap/blender/2106/3.1/python/bin/python3.10: No module named pip
INSTALL USING --USER TAG
 Command '['/snap/blender/2106/3.1/python/bin/python3.10', '-m', 'pip', 'install', 'mediapipe']' returned non-zero exit status 1.
/snap/blender/2106/3.1/python/bin/python3.10: No module named pip
Saved session recovery to '/tmp/quit.blend'
Unregister BlendArMocap

Blender quit

When run with sudo blender, the output is the same except for this extra warning:

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

I ran the installation steps manually myself and they completed successfully:

$ /snap/blender/2106/3.1/python/bin/python3.10 -m pip install --user numpy mediapipe opencv-python
Requirement already satisfied: numpy in ./.local/lib/python3.10/site-packages (1.22.3)
Requirement already satisfied: mediapipe in ./.local/lib/python3.10/site-packages (0.8.9.1)
Requirement already satisfied: opencv-python in ./.local/lib/python3.10/site-packages (4.5.5.64)
Requirement already satisfied: opencv-contrib-python in ./.local/lib/python3.10/site-packages (from mediapipe) (4.5.5.64)
Requirement already satisfied: protobuf>=3.11.4 in ./.local/lib/python3.10/site-packages (from mediapipe) (3.20.0)
Requirement already satisfied: attrs>=19.1.0 in ./.local/lib/python3.10/site-packages (from mediapipe) (21.4.0)
Requirement already satisfied: matplotlib in ./.local/lib/python3.10/site-packages (from mediapipe) (3.5.1)
Requirement already satisfied: absl-py in ./.local/lib/python3.10/site-packages (from mediapipe) (1.0.0)
Requirement already satisfied: six in ./.local/lib/python3.10/site-packages (from absl-py->mediapipe) (1.16.0)
Requirement already satisfied: pillow>=6.2.0 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (9.1.0)
Requirement already satisfied: fonttools>=4.22.0 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (4.32.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (1.4.2)
Requirement already satisfied: packaging>=20.0 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (21.3)
Requirement already satisfied: python-dateutil>=2.7 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (2.8.2)
Requirement already satisfied: pyparsing>=2.2.1 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (3.0.8)
Requirement already satisfied: cycler>=0.10 in ./.local/lib/python3.10/site-packages (from matplotlib->mediapipe) (0.11.0)

The Blender Snap package is "unconfined," so I don't believe it is an issue with Snap sandboxing, but I could be mistaken. Is this perhaps a Blender 3 issue?

NatalieWolfe avatar Apr 17 '22 02:04 NatalieWolfe

Not sure... I didn't try to install the dependencies on ubuntu using a snap installed blender. (I'm mainly using manjaro when it comes to linux..)

What I've experienced on ubuntu in the past has been the following: after pressing the install dependencies button the installation failed. After restarting blender and attempting the installation again it seemed to work. I can imagine this issue occurs because blenders ubuntu version doesn't get shipped with pip which may causes weird behaviour.

Maybe I'll use apt for debian systems in the future? Gotta test.

cgtinker avatar Apr 19 '22 14:04 cgtinker

I also use Blender snap version (Blender 3.1.2) because deb is too old, 2.83(!) ~~As your normal user, in terminal, simply pip install mediapipe opencv-python and run blender. No need to elevate user.~~

EDIT: Oops, I wrote too fast, it doesn't work because the snap path ~/snap/blender/2106/3.1/python/bin/python3.10 simply doesn't exist :cry:

A 2.93 deb package exists. As root, blender installs the addon and dependencies. Then as normal user, you can re-install the addon and run it (with a human metarig). BUT, ... it crashes blender as soon as you show a hand to capture.

j2l avatar May 20 '22 08:05 j2l

While this issues most likely still persist, please refer to #129 for now. I guess you have to install the dependencies manually (there will be help in the docs). I'll release a new version next week, you can try it on the main branch.

cgtinker avatar Feb 22 '23 12:02 cgtinker