[Bug 1832215] [NEW] If python package is installed under get_python_lib(prefix='/usr/local') it cannot be imported by python

vital 1832215 at bugs.launchpad.net
Mon Jun 10 10:18:32 UTC 2019


Public bug reported:

When `get_python_lib` function is called with `/usr/local` prefix it
returns path which is not included into `sys.path` list. Consequently if
python package is installed under this path it cannot be imported by
python.

Path which is returned:
$ /usr/bin/python3 -c "from distutils.sysconfig import *;print(get_python_lib(prefix='/usr/local'))"
/usr/local/lib/python3/dist-packages

`usr/local/path` which is present in `sys.path`
$ /usr/bin/python3 -c "import sys; print('\n'.join(sys.path))" | fgrep '/usr/local'
/usr/local/lib/python3.6/dist-packages

There is the same bug reported to the `python3` package
(https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1814653)
I created this report to stick it to the correct package.

1) The release of Ubuntu

$ lsb_release -rd
Description:	Ubuntu 18.04.2 LTS
Release:	18.04

2) The version of the package

$ apt-cache policy python3-distutils
python3-distutils:
  Installed: 3.6.7-1~18.04
  Candidate: 3.6.7-1~18.04
  Version table:
 *** 3.6.7-1~18.04 500
        500 http://ru.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://ru.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
        100 /var/lib/dpkg/status
     3.6.5-3 500
        500 http://ru.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        500 http://ru.archive.ubuntu.com/ubuntu bionic/main i386 Packages

3) What you expected to happen

Path returned by `get_python_lib(prefix='/usr/local')` call is present
in `sys.path` list.

4) What happened instead

`get_python_lib(prefix='/usr/local')` returns /usr/local/lib/python3
/dist-packages which is absent in `sys.path`

** Affects: python3-stdlib-extensions (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-stdlib-extensions in
Ubuntu.
https://bugs.launchpad.net/bugs/1832215

Title:
  If python package is installed under
  get_python_lib(prefix='/usr/local') it cannot be imported by python

Status in python3-stdlib-extensions package in Ubuntu:
  New

Bug description:
  When `get_python_lib` function is called with `/usr/local` prefix it
  returns path which is not included into `sys.path` list. Consequently
  if python package is installed under this path it cannot be imported
  by python.

  Path which is returned:
  $ /usr/bin/python3 -c "from distutils.sysconfig import *;print(get_python_lib(prefix='/usr/local'))"
  /usr/local/lib/python3/dist-packages

  `usr/local/path` which is present in `sys.path`
  $ /usr/bin/python3 -c "import sys; print('\n'.join(sys.path))" | fgrep '/usr/local'
  /usr/local/lib/python3.6/dist-packages

  There is the same bug reported to the `python3` package
  (https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1814653)
  I created this report to stick it to the correct package.

  1) The release of Ubuntu

  $ lsb_release -rd
  Description:	Ubuntu 18.04.2 LTS
  Release:	18.04

  2) The version of the package

  $ apt-cache policy python3-distutils
  python3-distutils:
    Installed: 3.6.7-1~18.04
    Candidate: 3.6.7-1~18.04
    Version table:
   *** 3.6.7-1~18.04 500
          500 http://ru.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
          500 http://ru.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
          100 /var/lib/dpkg/status
       3.6.5-3 500
          500 http://ru.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
          500 http://ru.archive.ubuntu.com/ubuntu bionic/main i386 Packages

  3) What you expected to happen

  Path returned by `get_python_lib(prefix='/usr/local')` call is present
  in `sys.path` list.

  4) What happened instead

  `get_python_lib(prefix='/usr/local')` returns /usr/local/lib/python3
  /dist-packages which is absent in `sys.path`

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-stdlib-extensions/+bug/1832215/+subscriptions



More information about the foundations-bugs mailing list