Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing with libtiff 4.0.10 on Ubuntu: #107

Open
rleigh-codelibre opened this issue Jun 8, 2019 · 2 comments
Open

Error importing with libtiff 4.0.10 on Ubuntu: #107

rleigh-codelibre opened this issue Jun 8, 2019 · 2 comments

Comments

@rleigh-codelibre
Copy link

rleigh-codelibre commented Jun 8, 2019

With Ubuntu 19.04, libtiff is failing to import with Python 3. The libtiff library and headers are installed.

It looks like tiff_h_4_0_10.py is missing. I see this is in git, but it's not yet released and installable with? (I didn't see any release tags, so I'm not sure what the current status is.) It's certainly working building by hand from git.

By the way, you might want to change the message sudo apt-get install libtiff4-dev to sudo apt-get install libtiff5-dev since this has been libtiff5 for several years now.

Kind regards,
Roger

% pip freeze
…
libtiff==0.4.2
…

% python
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtiff
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/ve/lib/python3.7/site-packages/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF, TIFF3D
  File "/tmp/ve/lib/python3.7/site-packages/libtiff/libtiff_ctypes.py", line 90, in <module>
    raise ValueError('Failed to find TIFF header file (may be need to '
ValueError: Failed to find TIFF header file (may be need to run: sudo apt-get install libtiff4-dev)
>>> 

% dpkg -s libtiff5
Package: libtiff5
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 535
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: same
Source: tiff
Version: 4.0.10-4
Depends: libc6 (>= 2.14), libjbig0 (>= 2.0), libjpeg8 (>= 8c), liblzma5 (>= 5.1.1alpha+20120614), libwebp6 (>= 0.5.1), libzstd1 (>= 1.3.2), zlib1g (>= 1:1.1.4)
Description: Tag Image File Format (TIFF) library
 libtiff is a library providing support for the Tag Image File Format
 (TIFF), a widely used format for storing image data.  This package
 includes the shared library.
Original-Maintainer: Laszlo Boszormenyi (GCS) <[email protected]>
Homepage: https://libtiff.maptools.org

% dpkg -s libtiff5-dev 
Package: libtiff5-dev
Status: install ok installed
Priority: optional
Section: oldlibs
Installed-Size: 22
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Source: tiff
Version: 4.0.10-4
Depends: libtiff-dev (>= 4.0.10-1)
Recommends: pkg-config
Description: Tag Image File Format library (TIFF), development files (transitional package)
 libtiff is a library providing support for the Tag Image File Format
 (TIFF), a widely used format for storing image data.  This package
 includes the development files, static library, and header files.
 .
 This is a transitional package. It can safely be removed.
Original-Maintainer: Laszlo Boszormenyi (GCS) <[email protected]>
Homepage: https://libtiff.maptools.org
@IdrisTheDragon
Copy link
Contributor

Digging into setup.py in the git, the current version is 0.4.4 while the latest release on pypi is outdated 0.4.2 (https://pypi.org/project/libtiff/).
I came across same issue where I couldn't use the released 0.4.2 from pypi as I couldn't install libtiff4-dev on Linux Mint 19.3 (based on Ubuntu 18.04.3 LTS).

But using

libtiff = { git = "https://github.com/pearu/pylibtiff.git", editable = true, ref = "master"}

in my pipfile to get the latest git version and installing libtiff5-dev, it worked perfectly.

So looks like fixes for using libtiff5-dev are already in place, but a release for version 0.4.4 is basically what is required for ease of use along with updating the error message as mentioned above in the libtiff/libtiff_ctypes.py line 102. (https://github.com/pearu/pylibtiff/blob/master/libtiff/libtiff_ctypes.py#L102)

@rleigh-codelibre
Copy link
Author

rleigh-codelibre commented Apr 19, 2020

Re-testing with Ubuntu 20.04 and libtiff 4.1.0 (libtiff5-dev):
[also requires #121 merging]

(test-libtiff) $ python
Python 3.8.2 (default, Mar 13 2020, 10:14:16) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtiff
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/test-libtiff/lib/python3.8/site-packages/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF, TIFF3D
  File "/tmp/test-libtiff/lib/python3.8/site-packages/libtiff/libtiff_ctypes.py", line 90, in <module>
    raise ValueError('Failed to find TIFF header file (may be need to '
ValueError: Failed to find TIFF header file (may be need to run: sudo apt-get install libtiff4-dev)

Please could this be fixed and a new version be uploaded to pypi? It's been broken and unusable for well over a year at this point. While I can rebuild my own copy locally, that's not tenable for end users.

The LTS Ubuntu release 18.04 didn't exhibit this problem due to using an older libtiff version. But the new LTS 20.04 does, and it makes libtiff completely unusable. As companies and projects migrate over, this will become increasingly common, and a fix would be very much appreciated.

pearu pushed a commit that referenced this issue Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants