0

I need to read tiff images into a NumPy array. However, as much as I would like to use PIL/Pillow, or MatPlotLib, to do this, I cannot. I am limited to the base python modules in python 2.6, since that is what is installed on the system that will execute on and I do not have sufficient privileges to install new modules or upgrade python. Is this going to be possible in any reasonable form?

2
  • Is libtiff available on your system? If so you could probably use pylibtiff Commented Oct 28, 2015 at 5:51
  • No, libtiff is not available. Commented Oct 28, 2015 at 17:03

1 Answer 1

1

First, don't mess with the system Python or complain that you cannot. That is just an imaginary problem. Whether you are using Linux or Mac, the system Python encironment is needed by the operating system. Even if you did have sudo rights you shouldn't touch it because the integrity of the operating system depends on it. Leave it alone and stop worrying about it. In El Capitan Apple has even put in a special protection layer to make sure the system Python is not modified, even by those who would otherwise have rights to do so.

What you should do it to install a clean Python environment (e.g. Anaconda) into a local folder in your home directory. You don't need any special access rights to do this, just read/write access to your home directory or your documents folder. If you can create and save files somewhere you have all the rights to need. Add the folder containing yor private Python interpreter to your path so it appears before the system Python and it will take presedence.

The best tool to read TIFF files is Christoph Gohlke's Tifffile module. You don't need to install anything, just dump Tifffile.py in your project. You can optionally compile Tiffile.c for faster decoding of LZW data, but it is not needed. This does not require any installation either.

http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html http://www.lfd.uci.edu/~gohlke/code/tifffile.c.html

Tifffile does require at least Python 2.7, though, as do most Python tools nowadays, which is another reason you want to set up a local Python environment.

Sign up to request clarification or add additional context in comments.

2 Comments

I agree, by far the best solution would be to install the modules I require, though it did not occur to me to do so in a local, user installation of python. However, in trying to do this, I find that (for some reason), I still cannot install anything...even into directories I know I have write access to. Maybe it is my own problem since I know very little about macs.
A Mac is basically an UNIX. If you can save files you have all the rights you need. It might be that you cannot run a binary installer, though, but don't worry. Just make an installation on your own Mac, e.g. using Anaconda from continuum.io. Then copy over the whole catalog. On my Mac it lives in ~/anaconda. Then edit the file ~/.bash_profile to contain the line export PATH="~/anaconda/bin:$PATH". Next time you open a terminal and type python the user installed version should be invoked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.