0

I installed python3-sip using apt and PyQt5-sip using pip3.

The first one is in /usr/share/sip/ and is version 4.19.7

$ sudo apt-cache policy python3-sip
python3-sip:
  Installed: 4.19.7+dfsg-1
  Candidate: 4.19.7+dfsg-1
  Version table:
 *** 4.19.7+dfsg-1 500
        500 http://ch.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

The latter is in /usr/local/ and its version is 4.19.15:

$ find /usr/local -iname "*sip*"
/usr/local/lib/python3.6/dist-packages/PyQt5/sip.so
/usr/local/lib/python3.6/dist-packages/PyQt5_sip-4.19.15.dist-info

When I load sipconfig from python3, here's what I have:

>>> import sipconfig
>>> sipcfg = sipconfig.Configuration()
>>> print("sip_module_dir:%s" % sipcfg.sip_mod_dir)
sip_module_dir:/usr/lib/python3.6/dist-packages

>>> print("sip_version_str:%s" % sipcfg.sip_version_str)
sip_version_str:4.19.7

How to load sip from the one installed by pip3, i.e. the version 4.19.15 in /usr/local/lib/python3.6/dist-packages/PyQt5/ instead of the system wide /usr/lib/python3.6/dist-packages installed with apt?

I always thought priority was given to user installed packages before system ones... but it's obviously not the case in this particular situation.

Updates:

I tried to install sip from its zip file here [1]:

So, I've unzipped the archive in /opt/sip-4.19.15 and then:

cd /opt/sip-4.19.15
$ python3 configure.py 

which gives me:

This is SIP 4.19.15 for Python 3.6.7 on linux.
The SIP code generator will be installed in /usr/bin.
The sip.h header file will be installed in /usr/include/python3.6m.
The sip module will be installed in /usr/lib/python3/dist-packages.
The sip.pyi stub file will be installed in /usr/lib/python3/dist-packages.
The default directory to install .sip files in is /usr/share/sip.
Creating sipconfig.py...
Creating top level Makefile...
Creating sip code generator Makefile...
Creating sip module Makefile...

Then I run make && sudo checkinstall but checkinstall wants to overwrite files from the sip-dev package that come from Ubuntu repositories:

(Reading database ... 486665 files and directories currently installed.)
Preparing to unpack .../sip_4.19.15-1_amd64.deb ...
Unpacking sip (4.19.15-1) ...
dpkg: error processing archive /opt/sip-4.19.15/sip_4.19.15-1_amd64.deb (--install):
 trying to overwrite '/usr/bin/sip', which is also in package sip-dev 4.19.7+dfsg-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /opt/sip-4.19.15/sip_4.19.15-1_amd64.deb
/var/tmp/tmp.FjW48f0ufY/dpkginstall.log (END)

The really strange thing is that it seems it was actually overwritten as the version changed from 4.19.7 to 4.19.15 and last modification time is now:

/usr/bin/sip -V
4.19.15 

I don't really understand the checkinstall behavior here...

Should I run the configure.py script with other output directories than the ones listed above? Like e.g.:

python3 configure.py \
-b /usr/local/bin \
-e /usr/local/include/python3.6 \
-d /usr/local/lib/python3.6/dist-packages \
--stubsdir /usr/local/lib/python3.6/dist-packages \
-v /usr/local/share/sip 


More informations:

[1] https://www.riverbankcomputing.com/static/Docs/sip/installation.html#downloading
https://www.riverbankcomputing.com/static/Docs/sip/command_line.html

s.k
  • 1,280
  • The search order is whatever is in sys.path - you can check with python3 -c 'import sys; print(sys.path)' for example – steeldriver Mar 28 '19 at 15:20
  • I just saw that I have a python2.7 path (from ros-melodic) on top of all python3 paths. :/ And that the packages in /usr/lib are on top of the ones in /usr/local/lib. So...why numpy e.g. loads from /usr/local/lib and not sip? – s.k Mar 28 '19 at 15:22

0 Answers0