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 in importing libtiff #12

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

error in importing libtiff #12

GoogleCodeExporter opened this issue Aug 5, 2015 · 11 comments

Comments

@GoogleCodeExporter
Copy link

I am trying to use pylibtiff to read tiff files into numpy array.. i installed 
the windows installer provided on the site and now if i try importing, python 
encounters with following error:

>>> from libtiff import *

Traceback (most recent call last):
  File "D:/Python27/testtifflib.py", line 4, in <module>
    from libtiff import *
  File "D:\Python27\lib\site-packages\libtiff\__init__.py", line 4, in <module>
    from .libtiff import libtiff, TIFF
  File "D:\Python27\lib\site-packages\libtiff\libtiff.py", line 35, in <module>
    raise ImportError('Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|..')
ImportError: Failed to find TIFF library. Make sure that libtiff is installed 
and its location is listed in PATH|LD_LIBRARY_PATH|..

i also tried this :

import sys
sys.path.append("D:\\Python27\\Lib\\site-packages\\libtiff")

from libtiff import *

but same error persists.. what can be done in this case??  any help is 
appreciated.. m i missing something here??


Original issue reported on code.google.com by asmi.ca...@gmail.com on 2 Feb 2011 at 12:35

@GoogleCodeExporter
Copy link
Author

The referred missing TIFF library is the libtiff binary.
You can crab it from
  http://gnuwin32.sourceforge.net/packages/tiff.htm

Another approach would be to use pure Python TIFF support.
For that TIFF library support should be disabled by not
importing the libtiff.py module (e.g. edit __init__.py file
accordingly).

Original comment by pearu.peterson on 3 Feb 2011 at 11:26

@GoogleCodeExporter
Copy link
Author

Hi,

I have the same problem. I installed first 'tiff-3.8.2-1.exe' and 
'pylibtiff-0.1-svn.win32.exe' afterward. And the libtiff location is listed 
under sys.path ...

So any ideas what to do?

Cheers, Sebi

Original comment by sebrh...@gmail.com on 17 Jan 2012 at 12:41

@GoogleCodeExporter
Copy link
Author

Could you try adding the location of the libtiff dll file to the system PATH 
environment variable so that os.environ['PATH'] contains this location.
And then try importing libtiff. 

Original comment by pearu.peterson on 17 Jan 2012 at 1:25

@GoogleCodeExporter
Copy link
Author

I am encountering the same problem, I have tried all the suggestions except to 
use pure Python TIFF support (as I have no idea how to do this). Does anyone 
have a solution by now?

Thanks!

Original comment by marcaure...@gmail.com on 26 Jun 2013 at 2:17

@GoogleCodeExporter
Copy link
Author

I am having the same issues could more light be shed on how to install

Thanks!

Original comment by Neel.A.L...@gmail.com on 11 Oct 2013 at 5:23

@GoogleCodeExporter
Copy link
Author

Hi,
I had/have the same problem. I work on debian with 0.3.0~svn78-3.1 and libtiff 
4.0.3. I was able to get a work around by copying 
/usr/share/pyshared/libtiff/tiff_h_4_0_1.py to my working directory and rename 
it tiff_h_4_0_3.py. It should work putting it in /usr/share/pyshared/libtiff 
but it didn't, but that's probably just because of a stupid mistake.

Good luck
Ben

Original comment by HBStri...@googlemail.com on 12 Mar 2014 at 4:20

@GoogleCodeExporter
Copy link
Author

If you use a 64-bit version of Windows, you should also copy libtiff3.dll to 
C:\Windows\SysWOW64\

I did this and it worked for me.

Original comment by KevinSco...@gmail.com on 27 Jan 2015 at 7:58

@GoogleCodeExporter
Copy link
Author

@Kevin : I tried that but still same problem

Original comment by nikhilga...@gmail.com on 28 Jan 2015 at 7:24

@GoogleCodeExporter
Copy link
Author

@Kevin: I have been struggled with this problem for almost whole day, and then 
this libtiff3.dll with 64-bit Windows 7 trick worked out, really nice. Thanks a 
lot!

Original comment by hzq....@gmail.com on 5 Feb 2015 at 3:38

@alice85
Copy link

alice85 commented Aug 12, 2015

Hi guys!
I had a similar problem under Windows 7: after half a day of bothering around with simply installing libtiff package (oh my!!!!) I stucked the other half of day with the PATH error, that was already mentioned on top of the present issue. My solution was quite simple - and it indeed embarrass me a little. But here is what I did:

The error is raised by libtiff_ctypes.py (originated in C:\Python27\Lib\site-packages\libtiff), line 41 because the tiff library is not found. In line 29 you can find the location WHERE the ctypes-module is searching for the tiff library. Since I am not a friend of changing tested and in principle working python modules I copied the location path from line 29 and reinstallled the tiff package - or GnuWin32 application - into this directory. Additionally I had to add C:\Program Files\GnuWin32\bin to the PATH environment variables. For newbies: This is done by the following
Go to Control Panel -> System, on the left side click on "Advanced system settings" and enter Admin-password. Then in slide "Advanced" click on "Environment Variables" (at the bottom of the window) and in "System Variables" you search for an entry called "PATH". Here, click on "Edit" (nothing else, don't delete!!!!!!), go to the end of the line and add a semicolon and the necessary path. Confirm with "OK" etc. In principle under Windows 7 it should already work, evtl you will have to reboot the PC once

By the way: the libtiff3.dll-copy thing, recommended by Kevin, didn't work for me as well ;)

Cheers!
Alice

@pearu
Copy link
Owner

pearu commented Feb 23, 2019

I recommend using conda libtiff.

@pearu pearu closed this as completed Feb 23, 2019
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

3 participants