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

Fail to import libtiff in Ubuntu 14.04 #30

Closed
GoogleCodeExporter opened this issue Aug 5, 2015 · 14 comments
Closed

Fail to import libtiff in Ubuntu 14.04 #30

GoogleCodeExporter opened this issue Aug 5, 2015 · 14 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.import libtiff


What is the expected output? What do you see instead?
Failed to find TIFF header file (may be need to run: sudo apt-get install 
libtiff4-dev)

What version of the product are you using? On what operating system?
Ubuntu 14.04

Please provide any additional information below.
Ubuntu 14.04 come with libtiff5 by default, replace it with libtiff4 seems not 
a simple task since several hundreds of package depends on libtiff5.

Original issue reported on code.google.com by wuxund...@gmail.com on 10 Sep 2014 at 8:50

@GoogleCodeExporter
Copy link
Author

I cannot reproduce this issue. I am using ubuntu 14.04 and I have libtiff5 
(4.0.3) installed. Could you copy full error message that you get?

Original comment by pearu.peterson on 13 Sep 2014 at 8:20

@GoogleCodeExporter
Copy link
Author

I don't have that system anymore. It was a fresh install of Ubuntu 14.04 . I 
installled python-libtiff after I installed the system, then it failed when I 
try to import libtiff and gave me the above message. I will reinstall it try to 
reproduce the problem and get back to you on Monday.

Original comment by wuxund...@gmail.com on 14 Sep 2014 at 6:05

@GoogleCodeExporter
Copy link
Author

I did another new installation of Ubuntu 14.04. Didn't do any kind of 
customization during the installation. After system bootup, I installed 
python-libtiff and ipython. Here is the error message again:

ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import libtiff
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-4492fa448634> in <module>()
----> 1 import libtiff

/usr/lib/python2.7/dist-packages/libtiff/__init__.py in <module>()
     18 __all__ = ['TIFF', 'TIFFfile', 'TiffArray', 'TiffFile', 'TiffFiles', 'TiffChannelsAndFiles', 'TiffBase']
     19
---> 20 from .libtiff_ctypes import libtiff, TIFF
     21 from .tiff import TIFFfile, TIFFimage, TiffArray
     22 from .tiff_file import TiffFile

/usr/lib/python2.7/dist-packages/libtiff/libtiff_ctypes.py in <module>()
     62         include_tiff_h = os.path.join('/usr','include','tiff.h')
     63     if not os.path.isfile(include_tiff_h):
---> 64         raise ValueError('Failed to find TIFF header file (may be need 
to run: sudo apt-get install libtiff4-dev)')
     65     # Read TIFFTAG_* constants for the header file:
     66     f = open (include_tiff_h, 'r')

ValueError: Failed to find TIFF header file (may be need to run: sudo apt-get 
install libtiff4-dev)

Original comment by wuxund...@gmail.com on 15 Sep 2014 at 5:58

@GoogleCodeExporter
Copy link
Author

Can you check that the following file exists:

  pylibtiff/libtiff/tiff_h_4_0_3.py

and can you import it?

Could you also send the output of the following Python commands:
{{{
import ctypes.util
lib = ctypes.util.find_library('tiff')
print lib
libtiff = ctypes.cdll.LoadLibrary(lib)
print libtiff
libtiff.TIFFGetVersion.restype = ctypes.c_char_p
libtiff.TIFFGetVersion.argtypes = []
print libtiff.TIFFGetVersion()
}}}


Original comment by pearu.peterson on 15 Sep 2014 at 6:44

@GoogleCodeExporter
Copy link
Author

pylibtiff/libtiff/tiff_h_4_0_3.py

This file is not there.


Here is the output from your commands:
LIBTIFF, Version 4.0.3
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.

Original comment by wuxund...@gmail.com on 15 Sep 2014 at 7:50

@GoogleCodeExporter
Copy link
Author

This means that you are not using the latest svn version of pylibtiff.
Grab it from svn repo and then it should work fine.

Original comment by pearu.peterson on 15 Sep 2014 at 9:04

@GoogleCodeExporter
Copy link
Author

Where. I download tiff_h_4_0_3.py and put it in 
/usr/lib/python2.7/dist-packages/libtiff/ seems it is working now.

Original comment by wuxund...@gmail.com on 15 Sep 2014 at 10:55

@GoogleCodeExporter
Copy link
Author

So, I gather that this is Ubuntu distribution problem: they should update 
python-libtiff package to the latest pylibtiff version.

Original comment by pearu.peterson on 17 Sep 2014 at 8:18

  • Changed state: WontFix

@jgazac
Copy link

jgazac commented Nov 12, 2015

Make a new "tiff_h_4_0_3.py" from https://github.com/coruus/pylibtiff/blob/master/libtiff/tiff_h_4_0_3.py
So put on /usr/lib/python2.7/dist-packages/libtiff/
This fix for me too.

@prativadas
Copy link

pip install libtiff
i tried a lot of commands but this one worked for me

@amy-langley
Copy link

For people who are finding this issue in 2019 because they are having problems with libtiff giving this error message, I found that it was happening because the file tiff_h_4_0_10.py was not present in the distribution package. Installing the package from github (pip install -e git+https://github.com/pearu/pylibtiff#egg=libtiff) resolved my issues.

@hughwang
Copy link

hughwang commented Oct 25, 2019

other than add
-e git+https://github.com/pearu/pylibtiff#egg=libtiff
to the requirements.txt,

we need to change original code from:
exec 'import %s as tiff_h' % (tiff_h_name)
to
exec 'from libtiff import %s as tiff_h' % (tiff_h_name)

to address this issue

@orwa-te
Copy link

orwa-te commented Jul 2, 2020

I am facing the same problem for the current conditions:
System: Ubuntu 20
Library version: 0.4.2
Install by: Pip
I tried adding tiff_h_4_0_10.py file to the path /home/orwa/anaconda3/envs/env_name/lib/python3.7/site-packages/libtiff but it did not resolve the problem! Could you please help?

@orwa-te
Copy link

orwa-te commented Jul 2, 2020

I solved the problem using this command : conda install -c conda-forge libtiff where I executed after uninstalling previously installed libtiff with Pip.
The conda-forge fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants