paulmelis / blender-ply-import

A Python module for faster import of PLY models in Blender
BSD 2-Clause "Simplified" License
23 stars 5 forks source link

Compilation fails on Ubuntu #5

Closed nantille closed 4 years ago

nantille commented 4 years ago

Hello Paul,

First of all thank you for this add-on! I hope to get it working. On Ubuntu, I cloned your repo and tried both ways with the latest master branch, either with the built-in python3.7m or by running blender -b -P setup.py and I get this error:

found bundled python: /opt/blender_mod/build_linux/bin/2.83/python
running build_ext
building 'readply' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/sergey/Developer/build_linux/deps/Release/sqlite/include -I/home/sergey/Developer/build_linux/deps/Release/bzip2/include -I/home/sergey/Developer/build_linux/deps/Release/lzma/include -I/home/sergey/Developer/build_linux/deps/Release/zlib/include -fPIC -fPIC -I./rply -I/opt/blender_mod/build_linux/bin/2.83/python/lib/python3.7/site-packages/numpy/core/include -I/opt/blender_mod/build_linux/bin/2.83/python/include/python3.7m -c readply.c -o build/temp.linux-x86_64-3.7/readply.o

readply.c:16:10: fatal error: Python.h: No such file or directory
 #include <Python.h>
          ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

Your cloned repository is somewhere else on disk, not in /opt.

paulmelis commented 4 years ago

Can you check that the directory /opt/blender_mod/build_linux/bin/2.83/python/include/python3.7m actually exists?

Do you have the python-dev package installed that contains the Python headers and libraries (the name of the package might be somewhat different on Ubuntu).

paulmelis commented 4 years ago

One issue that's probably at hand here is that even though Blender contains the python executable, it does not contain the development files, like headers and libraries. Hence the need to have to installed separately.

nantille commented 4 years ago

You're right, I had to compile it aside from Blender's Python. With Ubuntu's python3.6 (on LTS 18), compilation works fine. Then I tried installing python3.7-dev with apt-get and followed the steps to make it as python3 default. After that added numpy pip3 install numpy and compilation in place worked all the same python setup.py build_ext --inplace. Then I copied the corresponding .so file (in my case readply.cpython-37m-x86_64-linux-gnu.so) to the Blender Python lib /opt/blender_mod/build_linux/bin/2.83/python/lib/python3.7. Your script mesh_readply.py now works. Thanks!