pearu/pylibtiff

libtiff4 vs libtiff5 & finding header.

ayjayt opened this issue · 5 comments

That error is being raised on one of my machines. It has libtiff5-dev installed.

raise ValueError('Failed to find TIFF header file (may be need to '

This line makes it work (I'm using venv where golden-env is my venv folder):
cp /usr/include/x86_64-linux-gnu/tiff.h golden-env/include/

More concerning, I don't get this error on at all on my local box, and I can't even find tiff .h with sudo find / -name tiff.h /shrug. Not going to really complain about something working though.

Sorry, I meant to ping @pearu just for some visibility.

igg commented

Same here on ubuntu 20.04, fresh upgrade from 18.04. apt installed libtiff-dev, in python venv, pip install libtiff. Import libtiff in python results in tiff.h not found. copy from /usr/include/x86_64-linux-gnu/tiff.h to venv/include/ fixes it.

igg commented

This works outside of a venv. The problem is that in a venv, the various search strategies (~line 66 in libtiff_ctypes.py) don't work (sys.prefix is the venv root, not for e.g. /usr). The deeper "problem" is that system libraries are still used in a venv. Not sure how to probe the environment outside the venv while inside a venv.

igg commented

It seems that the purpose of the search is to generate a new tiff_h_4_1_0.py, which is missing from the distro since it's a new version. I got it to generate by copying the tiff.h, so I leave it as a gist (tiff_h_4_1_0.py) to include in subsequent releases.
Until then, download the file and copy it to (for e.g.) venv/lib/python2.7/site-packages/libtiff/

pearu commented

#130 likely fixes this issue. If not, please re-open.