Reputation: 73
I need to use libtiff
for a project.
pip install libtiff
C:\Program Files\GnuWin32\bin
After doing these steps, when I am running import libtiff, the following error is coming:
OSError Traceback (most recent call last)
<ipython-input-1-3fa0885ae753> in <module>
20 import os
21 import pickle
---> 22 from libtiff import TIFF
23 import libtiff
24 libtiff.libtiff_ctypes.suppress_warnings()
c:\users\ajain7\appdata\local\programs\python\python36\lib\site-packages\libtiff\__init__.py in <module>
18 __all__ = ['TIFF', 'TIFF3D', 'TIFFfile', 'TiffArray', 'TiffFile', 'TiffFiles', 'TiffChannelsAndFiles', 'TiffBase']
19
---> 20 from .libtiff_ctypes import libtiff, TIFF, TIFF3D
21 from .tiff import TIFFfile, TIFFimage, TiffArray
22 from .tiff_file import TiffFile
c:\users\ajain7\appdata\local\programs\python\python36\lib\site-packages\libtiff\libtiff_ctypes.py in <module>
48 'PATH|LD_LIBRARY_PATH|..')
49
---> 50 libtiff = ctypes.cdll.LoadLibrary(lib)
51
52 libtiff.TIFFGetVersion.restype = ctypes.c_char_p
c:\users\ajain7\appdata\local\programs\python\python36\lib\ctypes\__init__.py in LoadLibrary(self, name)
424
425 def LoadLibrary(self, name):
--> 426 return self._dlltype(name)
427
428 cdll = LibraryLoader(CDLL)
c:\users\ajain7\appdata\local\programs\python\python36\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
346
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:
350 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
Upvotes: 1
Views: 668
Reputation: 59
Another thing might have happened. VS code automatically searches for the numpy and other packages from predefined OS locations. You might be using the 32 bit version of numpy instead of a 64 bit version. To fix this, uninstall libtiff
from all locations by typing pip uninstall libtiff
Upvotes: 1