Issue #18 new

PIL doesn't install properly from pip on systems following the multiarch spec

Anonymous created an issue

Ubuntu 11.04 and later follow this spec, meaning that the libs and headers necessary for compiling PIL are now in /usr/lib/x86_64-linux-gnu/ and /usr/include/x86_64-linux-gnu/ (on 64-bit systems). The libs are subsequently not found by the PIL setup.

The following patch to fixes the issue for me:

{{{ --- setup.orig 2012-02-13 11:38:04.649950957 +0000 +++ 2012-02-13 11:38:16.937951219 +0000 @@ -147,6 +147,13 @@ add_directory(library_dirs, "/opt/local/lib") add_directory(include_dirs, "/opt/local/include")

  • elif sys.platform == "linux2":
  • import subprocess
  • arch = subprocess.check_output(["dpkg-architecture","-qDEB_HOST_MULTIARCH"]).strip()
  • add_directory(library_dirs, "/usr/lib/" + arch)
  • add_directory(include_dirs, "/usr/include/" + arch) + + add_directory(library_dirs, "/usr/local/lib") # FIXME: check /opt/stuff directories here? }}}

Comments (1)

  1. Milton Soares Filho

    Current tip offers PIL_SETUP_{module}_ROOT environment variables as a workaround, but it fails when specifying both libdir and includedir separated by ':'.

    $ PIL_SETUP_ZLIB_ROOT=/usr/lib/i386-linux-gnu:/usr/include pip install
      Downloading 6a64b3083e35.tar.bz2 (692Kb): 692Kb downloaded
      Running egg_info for package from
        Traceback (most recent call last):
          File "<string>", line 14, in <module>
          File "/tmp/pip-r521fn-build/", line 62, in <module>
            out("---", name, "set to", value, "by environment variable")
          File "/tmp/pip-r521fn-build/", line 17, in out
            sys.stdout.write(" ".join(args) + opts.get("end", "\n"))
        TypeError: sequence item 3: expected string, tuple found

    Wouldn't it be better using pkg-config --variable to retrieve each path? It may work on MacOS too, instead of dpkg-architecture, which works only on debian based distros.

    import subprocess
    def pkgconfig(module, variable):
        return subprocess.check_output(['pkg-config', '--variable=%s' % variable, module]).split()
    print pkgconfig('zlib', 'libdir')
  2. Log in to comment