Daniel-W-Blender-Python / VIPER-Blender-Mocap

A Blender Addon that uses István Sárándi's Metrabs 3D pose estimation model in Blender to capture a person's movements, and apply them to a character in a timely manner.
Other
11 stars 1 forks source link

Win10Home, Blender423: numpy.core.multiarray failed to import #1

Open weThere opened 3 weeks ago

weThere commented 3 weeks ago

Hello tried some basic scripting without luck and expertise so I hope you might have thoughts?

I'm hit with the following when trying to enable the addon in blender:

image image

I then attempted the install dependencies script, no luck, modified it to include numpy installation, no luck. Checking the console:

image

I modified the script stack so that it currently is:

image

But I'm still hit with "...failed to import".

Thanks in advance for any thoughts. Consistently hit similar hurdles when attempting installs of other camera to motion stream addons in Blender, a live camera feed to bone motion would do wonders for the animation workflow in some cases if any one of these would work (as vr/ar animation is not on the table yet), as I try to avoid to having to use external software or devices at all.

Daniel-W-Blender-Python commented 3 weeks ago

Hi!

I'm a little confused which version of the addon you're installing. Version 0.10-alpha includes the dependencies OpenCV and Mediapipe, whereas version 0.20-alpha includes the dependencies OpenCV and Tensorflow. If you're using version 0.20-alpha, I have a few different methods you can try:

  1. Comment out the line installing Mediapipe
    • Mediapipe is not needed for this version of the addon. I'll go ahead and remove it from the script.
    • This prevents any conflicting numpy installations with OpenCV and Mediapipe.
  2. Try changing the line reinstalling numpy to this: subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "numpy"])
    • Then run subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy==2.0.0"])
  3. Installing numpy manually
    • Try downloading these zip files, extracting them, and putting them into your C:/Program Files/Blender Foundation/Blender 4.2/4.2/python/lib/site-packages/ directory. numpy.zip numpy-1.24.3-py3.11.egg-info.zip

My go-to method for library issues is to install them manually. If you're still getting the issue, or have any other issues, I'd be happy to help!

weThere commented 2 weeks ago

Okay realised I was attempting to install .1v, switched to .2v (and installed numpy as in step 2. ). The error now changed or layered itself, the error is called with addon installation and attempt of enabling the addon (which it does not allow, also noticed indicated version says .1 though I am sure I downloaded the .2v zip):

image image

Waiting with step 3. and/or reattempt of step 2. to see if there is a solution to this new error.

Daniel-W-Blender-Python commented 2 weeks ago

My apologies. There was a typo in the script. The one you downloaded was, in fact, version 2.

I'm not exactly sure what is causing your error. You can check if your path for the addon is "C:/Users/{User}/AppData/Roaming/Blender Foundation/Blender/4.0/scripts/addons/VIPER-Blender-Mocap-main", rather than "C:/Users/{User}/AppData/Roaming/Blender Foundation/Blender/4.0/scripts/addons/VIPER-Blender-Mocap-0". If it is the second path, rename the addon to "VIPER-Blender-Mocap-main"

If those solutions don't work, try installing the addon using this file:

VIPER Blender Mocap(Python Script).zip

After unzipping the folder, you can install the addon with only the python script" titled "VIPER Blender Mocap.py." If that works, in order to use the addon, you will have to manually add a folder named "Video Frames" to your "C:/Users/{User}/AppData/Roaming/Blender Foundation/Blender/4.0/scripts/addons" directory, or you can run this script in the "Scripting" tab (change the directory name "User" to your user):

import os

try: os.mkdir("C:/Users/{User}/AppData/Roaming/Blender Foundation/Blender/4.0/scripts/addons/Video Frames") except: file_exists = True

(I don't think the tabbing transferred to the comment, so you might have to add after try: and except:)

After doing this, you'll have to change line 408 in the "VIPER Blender Mocap.py" script from frames_path = os.path.join(addon_dir, "Video Frames") to frames_path = os.path.join("C:/Users/{User}/AppData/Roaming/Blender Foundation/Blender/4.0/scripts/addons", "Video Frames"), making sure, again, to change your User name in the path.

If this works, you can also run this script directly in the scripting tab, rather than installing it as an addon. You would just have to keep running it each time you want to use the addon.

I hope this helps! If you have any other errors, feel free to ask!

weThere commented 2 weeks ago

The path issue resolved when changing addon folder name from "VIPER-Blender-Mocap-0.2.0" to "VIPER-Blender-Mocap-Main".

Numpy issue persists both with attempting step 2. (uninstall then reinstall to numpy 2.0.0) and 3. (Manual install to numpy 1.24.3):

image

This hinders me from testing single script solution, for now. Gonna let the issue breathe till evening, happy to hear from you anyhow and for the assistance this far.

Currently grasping, I would not know if other site packages can conflict each other, the following is the current state of said folder with numpy + numpy1.24.3 disregard the .zips, would blender version be significant? (Although its no option for me to rollback at the moment.), is multiarray the first thing importlib looks for or does this mean that it at least manages to find whatever else it needs to in the numpy library assuming multiarray is not the only requirement?:

(I've continuously had Blender in elevated launch throughout.)

d-----        03/11/2024     12:24                astunparse
d-----        03/11/2024     12:24                astunparse-1.6.3.dist-info
d-----        03/11/2024     11:14                autopep8-1.6.0.dist-info
d-----        03/11/2024     11:14                certifi
d-----        03/11/2024     11:14                certifi-2021.10.8.dist-info
d-----        03/11/2024     11:14                charset_normalizer
d-----        03/11/2024     11:14                charset_normalizer-2.0.10.dist-info
d-----        03/11/2024     12:23                clang
d-----        26/07/2024     00:30                colorama
d-----        26/07/2024     00:30                colorama-0.4.6.dist-info
d-----        03/11/2024     11:14                Cython
d-----        03/11/2024     11:14                Cython-0.29.30.dist-info
d-----        26/07/2024     00:30                docs
d-----        26/07/2024     00:30                dtw
d-----        26/07/2024     00:30                dtw_python-1.5.1.dist-info
d-----        26/07/2024     00:30                filelock
d-----        26/07/2024     00:30                filelock-3.15.4.dist-info
d-----        26/07/2024     00:30                fsspec
d-----        26/07/2024     00:30                fsspec-2024.6.1.dist-info
d-----        26/07/2024     00:30                functorch
d-----        03/11/2024     12:24                gast
d-----        03/11/2024     12:24                gast-0.6.0.dist-info
d-----        03/11/2024     12:24                google_pasta-0.2.0.dist-info
d-----        03/11/2024     12:24                grpc
d-----        03/11/2024     12:24                grpcio-1.67.1.dist-info
d-----        31/08/2024     16:04                gruut
d-----        31/08/2024     16:04                gruut-2.4.0.dist-info
d-----        31/08/2024     16:04                gruut_lang_en
d-----        31/08/2024     16:04                gruut_lang_en-2.0.1.dist-info
d-----        31/08/2024     16:04                gruut_lang_sv
d-----        31/08/2024     16:04                gruut_lang_sv-2.0.1.dist-info
d-----        03/11/2024     12:24                h5py
d-----        03/11/2024     12:24                h5py-3.12.1.dist-info
d-----        03/11/2024     11:14                idna
d-----        03/11/2024     11:14                idna-3.3.dist-info
d-----        26/07/2024     00:30                jinja2
d-----        26/07/2024     00:30                jinja2-3.1.4.dist-info
d-----        03/11/2024     12:24                keras
d-----        03/11/2024     12:24                keras-3.6.0.dist-info
d-----        03/11/2024     12:23                libclang-18.1.1.dist-info
d-----        26/07/2024     00:30                llvmlite
d-----        26/07/2024     00:30                llvmlite-0.43.0.dist-info
d-----        26/07/2024     00:30                maintainer
d-----        03/11/2024     12:24                markdown
d-----        03/11/2024     12:24                Markdown-3.7.dist-info
d-----        03/11/2024     12:24                markdown_it
d-----        03/11/2024     12:24                markdown_it_py-3.0.0.dist-info
d-----        26/07/2024     00:30                markupsafe
d-----        26/07/2024     00:30                MarkupSafe-2.1.5.dist-info
d-----        03/11/2024     11:14                MaterialX
d-----        03/11/2024     12:24                mdurl
d-----        03/11/2024     12:24                mdurl-0.1.2.dist-info
d-----        03/11/2024     12:34                mediapipe
d-----        03/11/2024     12:34                mediapipe-0.10.18.dist-info
d-----        03/11/2024     11:14                meson-0.63.0.dist-info
d-----        03/11/2024     11:14                mesonbuild
d-----        03/11/2024     12:24                ml_dtypes
d-----        03/11/2024     12:24                ml_dtypes-0.4.1.dist-info
d-----        26/07/2024     00:30                more_itertools
d-----        26/07/2024     00:30                more_itertools-10.3.0.dist-info
d-----        26/07/2024     00:30                mpmath
d-----        26/07/2024     00:30                mpmath-1.3.0.dist-info
d-----        03/11/2024     12:23                namex
d-----        03/11/2024     12:23                namex-0.0.8.dist-info
d-----        26/07/2024     00:30                networkx
d-----        26/07/2024     00:30                networkx-3.3.dist-info
d-----        26/07/2024     00:30                numba
d-----        26/07/2024     00:30                numba-0.60.0.dist-info
d-----        06/11/2024     10:06                numpy
d-----        06/11/2024     10:06                numpy-1.24.3-py3.11.egg-info
d-----        26/07/2024     00:31                openai_whisper-20231117.dist-info
d-----        03/11/2024     11:14                OpenImageIO
d-----        03/11/2024     12:23                optree
d-----        03/11/2024     12:23                optree-0.13.0.dist-info
d-----        03/11/2024     12:24                pasta
d-----        03/11/2024     12:36                pip
d-----        03/11/2024     12:36                pip-24.3.1.dist-info
d-----        03/11/2024     11:14                pkg_resources
d-----        03/11/2024     11:14                pxr
d-----        03/11/2024     11:14                pycodestyle-2.8.0.dist-info
d-----        03/11/2024     12:23                pygments
d-----        03/11/2024     12:23                pygments-2.18.0.dist-info
d-----        03/11/2024     11:14                PyOpenColorIO
d-----        03/11/2024     11:14                pyximport
d-----        26/07/2024     00:30                regex
d-----        26/07/2024     00:30                regex-2024.7.24.dist-info
d-----        03/11/2024     11:14                requests
d-----        03/11/2024     11:14                requests-2.27.1.dist-info
d-----        03/11/2024     12:24                rich
d-----        03/11/2024     12:24                rich-13.9.4.dist-info
d-----        26/07/2024     00:30                scipy
d-----        26/07/2024     00:30                scipy-1.14.0.dist-info
d-----        26/07/2024     00:30                scipy.libs
d-----        03/11/2024     12:34                sentencepiece
d-----        03/11/2024     12:34                sentencepiece-0.2.0.dist-info
d-----        03/11/2024     11:14                setuptools
d-----        03/11/2024     11:14                setuptools-63.2.0.dist-info
d-----        26/07/2024     00:30                sympy
d-----        26/07/2024     00:30                sympy-1.13.1.dist-info
d-----        03/11/2024     12:24                tensorboard
d-----        03/11/2024     12:24                tensorboard-2.18.0.dist-info
d-----        03/11/2024     12:23                tensorboard_data_server
d-----        03/11/2024     12:23                tensorboard_data_server-0.7.2.dist-info
d-----        03/11/2024     12:24                tensorflow
d-----        03/11/2024     12:24                tensorflow-2.18.0.dist-info
d-----        03/11/2024     12:24                tensorflow_intel-2.18.0.dist-info
d-----        03/11/2024     12:23                tensorflow_io_gcs_filesystem
d-----        03/11/2024     12:23                tensorflow_io_gcs_filesystem-0.31.0.dist-info
d-----        03/11/2024     12:23                termcolor
d-----        03/11/2024     12:23                termcolor-2.5.0.dist-info
d-----        31/08/2024     16:04                tests
d-----        26/07/2024     00:30                tiktoken
d-----        26/07/2024     00:30                tiktoken-0.7.0.dist-info
d-----        26/07/2024     00:30                tiktoken_ext
d-----        03/11/2024     11:14                toml
d-----        03/11/2024     11:14                toml-0.10.2.dist-info
d-----        26/07/2024     00:30                torch
d-----        26/07/2024     00:31                torch-2.4.0.dist-info
d-----        26/07/2024     00:31                torchgen
d-----        26/07/2024     00:30                tqdm
d-----        26/07/2024     00:30                tqdm-4.66.4.dist-info
d-----        26/07/2024     00:30                typing_extensions-4.12.2.dist-info
d-----        03/11/2024     11:14                urllib3
d-----        03/11/2024     11:14                urllib3-1.26.8.dist-info
d-----        03/11/2024     12:23                werkzeug
d-----        03/11/2024     12:23                werkzeug-3.1.1.dist-info
d-----        03/11/2024     12:23                wheel
d-----        03/11/2024     12:23                wheel-0.44.0.dist-info
d-----        26/07/2024     00:31                whisper
d-----        31/08/2024     16:04                whisper_timestamped
d-----        31/08/2024     16:04                whisper_timestamped-1.15.4.dist-info
d-----        03/11/2024     12:23                wrapt
d-----        03/11/2024     12:23                wrapt-1.16.0.dist-info
d-----        03/11/2024     12:26                zstandard
d-----        03/11/2024     11:14                zstandard-0.16.0.dist-info
d-----        03/11/2024     11:14                _distutils_hack
d-----        03/11/2024     11:15                __pycache__
-a----        05/06/2024     14:48         159942 autopep8.py
-a----        05/06/2024     14:48            544 cython.py
-a----        05/06/2024     14:48            152 distutils-precedence.pth
-a----        15/10/2024     02:33         407040 extern_draco.dll
-a----        26/07/2024     00:30          11207 isympy.py
-a----        05/11/2024     14:28          17851 numpy-1.24.3-py3.11.egg-info.zip
-a----        05/11/2024     14:28        7172413 numpy.zip
-a----        05/06/2024     14:48         107821 pycodestyle.py
-a----        05/06/2024     14:50        5799936 pyopenvdb.cp311-win_amd64.pyd
-a----        05/06/2024     14:48            121 README.txt
-a----        26/07/2024     00:30              0 scipy-1.14.0-cp311-cp311-win_amd64.whl
-a----        05/06/2024     14:47           2008 sitecustomize.py
-a----        26/07/2024     00:30         134451 typing_extensions.py
Daniel-W-Blender-Python commented 2 weeks ago

I noticed you still have the zip files for numpy in your folder. Try removing those. Otherwise, try reinstalling Blender 4.2 if you can. You might have some issues with the Blender libraries. Also, try checking your Python version. That could also play a role. Check your Python version using these commands in the scripting tab(in my case, python310.zip): image

weThere commented 2 weeks ago

There was a difference in pyversion between you and me, not certainly the issue but you made me think for the right problem seemingly!

Referenced this: https://blender.stackexchange.com/questions/316343/numpy-errors-with-compatable-addons-4-1

Had a lot off carryover settings, libraries and packages from blender 3.x that didn't mesh with current addons, did a factory reinstall of blender423 and manually backuped userpreferences and addons from prior "bad" version of blender423 appdata directory allowing the base install of blender423 to install pure site-packages, python and libraries.

Addon activated, now I'll have to test it and hopefully bother you no further with this issue at least.

I apologize for what in the end was a trivial issue, first time encountering it to be fair, appreciate your responsiveness all the same.

Daniel-W-Blender-Python commented 2 weeks ago

That's great! Thanks for sharing this issue!