Open HungryDoodles opened 1 year ago
THANKS a lot for your tutorial. Sorry for that I did not have a Windows machine and can not well test. I will fix some typos and keep the issue open until the next version.
BTW, I think you do not need to build and install the Python from the source as Blender already has its own Python environment. You may try to add '-t ' when installing packages. (https://blender.stackexchange.com/questions/266287/how-to-install-python-packages-using-the-pip-that-now-comes-with-blender) And the "blender" bl_info should be "(3, 2, 0)" I think.
Here are my steps:
python.exe -m pip install -r requirements.txt
, I deleted matplotlib gradio
and deleted the corresponding code in the downloaded zip file. model = GenMM(device='cuda' if torch.cuda.is_available() else 'cpu', silent=True)
with model = GenMM.GenMM(device='cuda' if torch.cuda.is_available() else 'cpu', silent=True)
Problem
Trying to simply follow the instructions provided in readme is a mere quarter of what needs to be done.
Quick Fix
First, as of Blender 3.6.0, python version that goes with it is 3.10.12, the original source needs to be downloaded from here. It is needed for torch. While that's downloading, Visual Studio 2022 or newer is required for building the lib, download if you don't have any.
Next, "pip" will try to install libs for the local python. The python.exe -m pip command should be used instead. Moreover, as Blender lacks python building tools, their installation/upgrade is required. That being said:
pathtoblender/python/bin/python.exe -m pip install --upgrade pip
pathtoblender/python/bin/python.exe -m pip install --upgrade wheel
pathtoblender/python/bin/python.exe -m pip install --upgrade setuptools
pathtoblender being the path, well, to blender, for example C:\Program Files\Blender Foundation\Blender 3.6\3.6.It is now possible to install the requirements:
pathtoblender/python/bin/python.exe -m pip install -r pathtoGenMM/docker/requirements.txt
Matplotlib may fail but is required as it is imported in init.py, to fix this it is enough to install any latest version provided by pip:pathtoblender/python/bin/python.exe -m pip install mathplotlib
Also, Blender's python is missing a tiny requirement:
pathtoblender/python/bin/python.exe -m pip install imageio
There are no binaries provided with Python 3.10.12 (that I could find in a reasonable amount of time), hence must be compiled manually. Source code downloaded from python website earlier contains Visual Studio project files in PCbuild directory. Open pcbuild.sln in Visual Studio, set configuration to Release, run build with Ctrl+Shift+B. Some may fail, but that's fine. PCbuild should now contain python310.lib.
Copy files as follows:
pythonsource/Include -> pathtoblender/python/include
pythonsource/PC -> pathtoblender/python/include
python310.lib -> pathtoblender/python/libs
It should now be safe to run (referring to original readme, ${CUDA} being cu117, cu118 or cpu):
pathtoblender/python/bin/python.exe -m pip install torch-scatter==2.1.0 -f https://data.pyg.org/whl/torch-1.12.0+${CUDA}.html
The addon requires two additional fixes in init.py to be operable (at least on Windows): Open init.py, find bl_info at around line 29, replace is with next addon description:
Far-far into the document at around 1255th the following line can be found:
model = GenMM(device='cuda' if torch.cuda.is_available() else 'cpu', silent=True)
Replace it withmodel = GenMM.GenMM(device='cuda' if torch.cuda.is_available() else 'cpu', silent=True)
Pack the GenMM back to .zip (without compression for maximum compatibility, as Blender does not support Deflate64 compression for example) and install as addon. It should appear in Animation category and must be enabled first.
Thereafter it should work if the parameters are set correctly.
Disclaimer: I have a negligible experience working with python and python libs, there may easily be a more proper fix that I'm not aware of. However, only after those tricks I managed to finally take the source armature from demo blender file and get a... "synsized" animation.