Debian/Ubuntu Python bug leads to python3 installation to incorrect site-packages folder

Issue #787 wontfix
Jack Hale created an issue

Install DOLFIN using python3 with --prefix=/usr/local on Ubuntu 16.04 (and probably more recent Debian as well) leads to the DOLFIN Python module being installed to /usr/local/lib/python3/dist-packages.

Notice the lack of .5. This path is not even in the python3 interpreters default path for searching for modules.

The CMakeLists.txt sets this path using the following (correct!) code which you can run in the interpreter directly:

import distutils.sysconfig
print distutils.sysconfig.get_python_lib(plat_specific=True, prefix='/usr/local')

Change to any other prefix except /usr/local and you get the correct python3.5 folder.

Other projects are having issues too e.g. https://trac.osgeo.org/gdal/ticket/6671 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838323.

Comments (9)

  1. Jack Hale reporter

    One liner:

    python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix="/usr/local"))'
    
  2. Jack Hale reporter

    I've taken a look at the code for distutils.sysconfig.get_python_lib and the /usr/local/lib/python3/dist-packages is definitely as the developers intended it. The mistake then is that that path is not in sys.path which is more of a Debian/Ubuntu packaging issue.

  3. Anders Logg (Chalmers)

    Is this really a blocker for the release of 2016.2? Looks like a bug in Debian. Isn't it enough that we are aware of this bug and know how to work around it? (I assume by setting PYTHONPATH.)

  4. Jack Hale reporter

    I agree @logg, its an upstream issue. I have a workaround for this involving *.pth files that doesn't break py2/py3 installs that I will write up in here.

  5. Prof Garth Wells

    Would this be an issue if we used setuptools to install the DOLFIN Python module? I presume then that the process would be self-consistent?

  6. Log in to comment