Hello! I want to install blender as a python module in my conda environment.
According to the Building Blender as a Python Module, I use the following command:
make bpy
make install
But the bpy module is installed in $HOME/.local/lib/python3.11/site-packages/bpy/. I want to install it into my conda environment, i.e., $HOME/miniconda3/envs/rt/lib/python3.9/site-packages.
It seems that I should use the Manual CMake Setup to change the install path, but I can’t execute make bpy as described in Building Blender as a Python Module, after I changed the variables mentioned in Local Install. And the result is a CXX library if I execute make.
How can I install bpy as a python module in my self-defined path?
Thanks.
Thank you for your suggestion.
I have tried the command, and the result is
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- bpy
Current channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
Actually, I have installed the bpy module in my conda env. Now the problem is
I solved this problem through recreating a conda environment. But now the problem becomes:
(rt) xzx@h3c:~$ python -c "import bpy, os; bpy.ops.wm.save_as_mainfile(filepath=os.path.abspath('my.blend'))"
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.3 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "<string>", line 1, in <module>
AttributeError: _ARRAY_API not found
Unable to initialise audio
ImportError: numpy.core.multiarray failed to import
The version of Numpy in my env is 2.1.3, I don’t know why version 1.x is used.