problem when installing dependency `lxml`: `Python.h` file not found
zhuoqun-chen opened this issue · comments
Describe the bug
When using the provided install_requirements.py
to install the dependencies, one of the optional depency lxml
failed to be installed because Python.h
file is not found when building the wheel:
To Reproduce
Steps to reproduce the behavior:
- download
install_requirements.py
and go to the path where this script is downloaded - execute
$YOUR_BLENDER_EXECUTABLE -b —python install_requirements.py
- press
y
when prompted with theDo you want to proceed? [y/n]
question - the bug occurs saying that
lxml
wheel failed to be built
Expected behavior
The optional dependency lxml
can also be installed.
Screenshots
See the description section above.
Desktop (please complete the following information)
- OS:
MacOS
- Version
Ventura 13.4
running onApple M1 Pro
Additional context (Solution)
This issue can be viewed as a reference in case someone in the future has the same problem as me.
This problem can be fixed by following these steps:
- find the python version your blender is using (
3.10.12
in my case) - use
conda
create an environment with the same python version as above, e.g.,conda create -n blender_ws python=3.10.12
) - confirm that there is
Python.h
located inside~/miniconda3/envs/blender_ws/include/python3.10/Python.h
- go into the terminal and add environment path
export C_INCLUDE_PATH=“~/miniconda3/envs/blender_ws/include/python3.10”
- execute the install script again within the same terminal:
$YOUR_BLENDER_EXECUTABLE -b —python install_requirements.py
lxml
should be successfully installed
Thanks for reporting this and contributing a possible solution.
It seems blender on Mac is not properly installing python-dev, so it seems required to install this manually. Please not this similar issue and solution here on Linux: https://blender.stackexchange.com/a/107381
Also lxml is an optional dependency. If it's not available for you you can comment it from the requirements then the plain xml of python should be used.
I consider this as solved