Open mariocorradetti opened 2 years ago
I have the same problem (basically the same error message) trying to pip install bpy on mac python 3.9
Just went through this. The pip page specifies >=3.7 and <3.8 so I'd suggest the following steps
python --version
- mine was Python 3.7.13)pip install future_fstrings
because it's going to complain about thatpip install bpy && bpy_post_install
Same problem for me. Funny there's no 3.7 installer for windows, the only version this package works with: https://www.python.org/downloads/windows/ (@AdamStormhardtGH I assume this is why you suggested the virtual environment.)
An update on this.
I ended up abandoning a pip installation after seeing some more issue and just leveraging the bpy
installed as part of the blender package.
This lets me:
My new commands are using subprocess to just call the python command.
import subprocess
blender_job_command = f"blender {cwd}/src/blend/template_scene.blend --python {cwd}/src/scripts/my_main_python_script.py"
subprocess.Popen(blender_job_command, shell=True, stdout=subprocess.PIPE)
Note that this has kinda made me have to work more modularly and pull a lot of the blender interaction out into more discrete steps, but it's pretty reliable.
/Applications/Blender.app/Contents/Resources/3.1/python/bin/python3.10
Doing pip installs will default to local, which is okay if you want to add an environment variable in the next step.
import os
sys.path.append(f'~/.local/lib/python3.10/site-packages/') #python packages registration. This lets us use pandas etc
sudo -H pip install <package_name>
-H
tells pip not to install into the .local location. Note that I found I needed sudo in order for my terminal to respect -HNot an ideal fix, but it's removed some of the headaches around this bpy stuff. I haven't worked with a library which acts like this before. Hopefully it becomes a little more universally installable in the future.
I have tried to install bpy thorugh termial (pip) and also by PyCharm, but i obtain always this error regardless i have updated all the other libraries just in case. I don't know ho to resolve this. Please help me :(