1

My problem is pretty much identical to here except none of the solutions there are working for me. I'm assuming the issue there was for python 2.7 because my issue is specific to python 3.5.1

TL;DR: The following commands all do not work, details below

  • sudo apt-get install libtiff5
  • sudo dpkg -i libtiff5_4.0.3-7ubuntu0.3_amd64.deb
  • python setup.py install (pylibtiff, a libtiff wrapper)
  • conda install libtiff
  • pip install libtiff

What I've tried:

Karel's Method

cornelis@Bob:~$ sudo apt-get install libtiff5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libtiff5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 342 not upgraded.
cornelis@Bob:~$ python
Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec  7 2015, 11:16:01) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from libtiff import TIFF
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'libtiff'

ShubhamGG's method (Modified for libtiff5)

cornelis@Bob:~/Downloads$ sudo dpkg -i libtiff5_4.0.3-7ubuntu0.3_amd64.deb
(Reading database ... 228352 files and directories currently installed.)
Preparing to unpack libtiff5_4.0.3-7ubuntu0.3_amd64.deb ...
Unpacking libtiff5:amd64 (4.0.3-7ubuntu0.3) over (4.0.3-7ubuntu0.3) ...
Setting up libtiff5:amd64 (4.0.3-7ubuntu0.3) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
cornelis@Bob:~/Downloads$ python
Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec  7 2015, 11:16:01) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from libtiff import TIFF
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cornelis/Downloads/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF, TIFF3D
  File "/home/cornelis/Downloads/libtiff/libtiff_ctypes.py", line 31
    print 'You should add %r to PATH environment variable and reboot.' % (os.path.dirname (lib))
                                                                     ^
SyntaxError: invalid syntax
>>> 

I'm not sure what the %r to PATH environment variable means. However, I did reboot. No effect.

Next I tried pylibtiff:

cornelis@Bob:~/Downloads/pylibtiff-svn$ python setup.py install
Appending libtiff.bitarray configuration to libtiff
Ignoring attempt to set 'name' (from 'libtiff' to 'libtiff.bitarray')
Appending libtiff configuration to 
Ignoring attempt to set 'name' (from '' to 'libtiff')
Warning: Assuming default configuration (libtiff/bitarray-0.3.5-numpy/bitarray/{setup_bitarray,setup}.py was not found)Traceback (most recent call last):
  File "setup.py", line 96, in <module>
    configuration = configuration,
  File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/core.py", line 135, in setup
    config = configuration()
  File "setup.py", line 67, in configuration
    config.get_version('libtiff/version.py')
  File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1918, in get_version
    version_module = imp.load_module('_'.join(n.split('.')),*info)
  File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 658, in exec_module
  File "<frozen importlib._bootstrap_external>", line 764, in get_code
  File "<frozen importlib._bootstrap_external>", line 724, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "libtiff/version.py", line 30
    print version
                ^
SyntaxError: Missing parentheses in call to 'print'

Conda attempt

cornelis@Bob:~/Downloads$ conda install libtiff
Fetching package metadata: ....
Solving package specifications: ....................
# All requested packages already installed.
# packages in environment at /home/cornelis/anaconda3:
#
libtiff                   4.0.6                         1  
cornelis@Bob:~/Downloads$ python
Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec  7 2015, 11:16:01) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from libtiff import TIFF
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cornelis/Downloads/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF, TIFF3D
  File "/home/cornelis/Downloads/libtiff/libtiff_ctypes.py", line 31
    print 'You should add %r to PATH environment variable and reboot.' % (os.path.dirname (lib))
                                                                     ^
SyntaxError: invalid syntax
>>> 

Pip attempt

cornelis@Bob:~/Downloads$ pip install libtiff
Collecting libtiff
  Using cached libtiff-0.4.0.tar.gz
    Complete output from command python setup.py egg_info:
    Warning: Assuming default configuration (libtiff/bitarray-0.3.5-numpy/bitarray/{setup_bitarray,setup}.py was not found)Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-90idcgcx/libtiff/setup.py", line 96, in <module>
        configuration = configuration,
      File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/core.py", line 135, in setup
        config = configuration()
      File "/tmp/pip-build-90idcgcx/libtiff/setup.py", line 67, in configuration
        config.get_version('libtiff/version.py')
      File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1918, in get_version
        version_module = imp.load_module('_'.join(n.split('.')),*info)
      File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 234, in load_module
        return load_source(name, filename, file)
      File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 172, in load_source
        module = _load(spec)
      File "<frozen importlib._bootstrap>", line 693, in _load
      File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 658, in exec_module
      File "<frozen importlib._bootstrap_external>", line 764, in get_code
      File "<frozen importlib._bootstrap_external>", line 724, in source_to_code
      File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
      File "libtiff/version.py", line 30
        print version
                    ^
    SyntaxError: Missing parentheses in call to 'print'
    Appending libtiff.bitarray configuration to libtiff
    Ignoring attempt to set 'name' (from 'libtiff' to 'libtiff.bitarray')
    Appending libtiff configuration to
    Ignoring attempt to set 'name' (from '' to 'libtiff')

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-90idcgcx/libtiff
  • Your title says python 3.4 - but your session output says Python 3.5.1 |Anaconda 2.4.1 - maybe you need to use conda install? – steeldriver Feb 11 '16 at 22:37
  • Same issue as one of the others, I'll update my question with what I get with conda – Frikster Feb 11 '16 at 22:42
  • Ah yes, I didn't notice that. I'm using Python 3.4 as my interpreter in Pyharm. But apparently I have python 3.5 in my terminal. Not sure what I should make of that yet. – Frikster Feb 11 '16 at 22:48
  • I searched a bunch on Launchpad and on Google in general but I couldn't find any TIFF libraries compatible with Python 3. – David Foerster Feb 11 '16 at 23:39
  • Which I guess would explain why we've always used Python 2.7 when the need arose. Sighs, naturally some packages I'm using require Python 3.4. So I'm between a rock and a hard place. Fortunately, I have the option to abandon tiffs for now. There are other formats. – Frikster Feb 16 '16 at 3:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.