If python package is installed under get_python_lib(prefix='/usr/local') it cannot be imported by python
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python3-stdlib-extensions (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
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(
/usr/local/
`usr/local/path` which is present in `sys.path`
$ /usr/bin/python3 -c "import sys; print('
/usr/local/
There is the same bug reported to the `python3` package (https:/
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://
500 http://
100 /var/lib/
3.6.5-3 500
500 http://
500 http://
3) What you expected to happen
Path returned by `get_python_
4) What happened instead
`get_python_
The root cause is the Debian patch: https:/ /salsa. debian. org/cpython- team/python3- stdlib/ blob/master/ debian/ patches/ 3.6/distutils- install- layout. diff
The patch changes behavior of the `get_python_lib` for two paths '/usr' and '/usr/local', see: https:/ /salsa. debian. org/cpython- team/python3- stdlib/ blob/master/ debian/ patches/ 3.7/distutils- install- layout. diff
Lines 144 and 152-157.
I would suggest remove '/usr/local' from the line 144 to fix.