not possible to import libtiff

Bug #1401855 reported by Non Given
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pylibtiff (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

****************************************************************************************************
$ lsb_release -rd
Description: Ubuntu 14.04.1 LTS
Release: 14.04
****************************************************************************************************

****************************************************************************************************
$ apt-cache policy python-libtiff
python-libtiff:
  Installed: 0.3.0~svn78-3.1
  Candidate: 0.3.0~svn78-3.1
  Version table:
 *** 0.3.0~svn78-3.1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status
****************************************************************************************************

Trace back is:
****************************************************************************************************
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF
  File "/usr/lib/python2.7/dist-packages/libtiff/libtiff_ctypes.py", line 65, in <module>
    raise ValueError('Failed to find TIFF header file (may be need to run: sudo apt-get install libtiff4-dev)')
ValueError: Failed to find TIFF header file (may be need to run: sudo apt-get install libtiff4-dev)
****************************************************************************************************

However libtiff4-dev is installed (as is libtiff5-dev)

It seems that the header file tiff.h is now located in /usr/include/x86_64-linux-gnu/ rather than /usr/include.

I therefore changed the code so that line 63 in "libtiff_ctypes.py" accounts for this. libtiff then finds the tiff.h file.

However..
****************************************************************************************************
>>> import libtiff
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF
  File "/usr/lib/python2.7/dist-packages/libtiff/libtiff_ctypes.py", line 79, in <module>
    value = eval(value)
  File "<string>", line 1
    (1
     ^
SyntaxError: unexpected EOF while parsing
****************************************************************************************************

Which proves to be due to line 337 in tiff.h.
#define COCODINGMETHODS_T4_1D (1 << 1)

It seems that libtiff_ctypes.py does not parse the values in the header properly when a bitshift is present. I tried manually replacing the relavent values using e.g.:
 if name == " COCODINGMETHODS_T4_1D": value = "(1 << 1)"

However, another error is thrown latter during import.

And that is all I can manage right now..

Tags: libtiff python
Revision history for this message
rdks (rdks-deactivatedaccount) wrote :

The problem seems to be that the the version in 14.04 (0.3.0~svn78-3.1) doesn't support libtiff5 yet, but libtiff4 isn't provided any longer.
There was an bug report on that in the upstream project before: https://code.google.com/p/pylibtiff/issues/detail?id=30

I just build the latest version of pylibtiff (svn107) on 14.04 x86_64 and can confirm, that this issue doesn't exist in that version any more.

So the proper solution here would be to upgrade the python-libtiff package to a more recent version that supports libtiff5.

Changed in pylibtiff (Ubuntu):
status: New → Confirmed
Revision history for this message
rdks (rdks-deactivatedaccount) wrote :

I contacted the Debian MED packaging team, who currently are the maintainers of this package, and requested an update to a newer versions that supports libtiff5.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.