[MCOL-1048] debian9 api python bindings built for python3 but installed in python2 Created: 2017-11-21  Updated: 2023-10-26  Resolved: 2018-01-12

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.1.2
Fix Version/s: 1.1.3

Type: Bug Priority: Major
Reporter: David Thompson (Inactive) Assignee: David Thompson (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Sprint: 2017-25, 2018-01

 Description   

If you do a package install of mcsapi on debian9 then the python bindings are built against python3 but installed to the python2 dist-packages directory.

root@debian9:~# python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymcsapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/pymcsapi.py", line 21, in <module>
    _pymcsapi = swig_import_helper()
  File "/usr/lib/python2.7/dist-packages/pymcsapi.py", line 20, in swig_import_helper
    return importlib.import_module('_pymcsapi')
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: dynamic module does not define init function (init_pymcsapi)
>>>
root@debian9:~# cd /usr/lib/python2.7/dist-packages/
root@debian9:/usr/lib/python2.7/dist-packages# cp pymcsapi.py _pymcsapi.so ../../python3/dist-packages/
root@debian9:/usr/lib/python2.7/dist-packages# python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymcsapi
>>>
>>>



 Comments   
Comment by David Thompson (Inactive) [ 2017-11-21 ]

on debian 9, cmake detects pythonlibs as 3 by default even though 2.7 also installed:

-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (found version "3.5.3")

Comment by David Thompson (Inactive) [ 2017-12-08 ]

A sort of workaround is to copy the module to the correct python 3.5 directory and use python3:

cd /usr/lib/python2.7/dist-packages/
cp pymcsapi.py _pymcsapi.so ../../python3.5/
 
# python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymcsapi
>>>

Comment by Jens Röwekamp (Inactive) [ 2017-12-20 ]

Should be fixed, but no compilation for both Python 2.7 and Python 3 through CMake. New ticket?

Comment by David Thompson (Inactive) [ 2017-12-20 ]

jens.rowekamp can you add the details of what now happens which is at least usable

Comment by Jens Röwekamp (Inactive) [ 2018-01-02 ]

When compiled in Debian9 (or any other distro) with the packet python3-dev (or equivalent) installed, _pymcsapi.so is compiled against python3 and put in /usr/lib/python3/dist-packages/. If no python3-dev can be found but libpython-dev / python2.7-dev is installed, _pymcsapi.so is compiled against python2.7.

Comment by Andrew Hutchings (Inactive) [ 2018-01-12 ]

Due to MCOL-1122 I suspect this is no longer valid, so should we close this?

Comment by Jens Röwekamp (Inactive) [ 2018-01-12 ]

That's correct my MCOL-1048 solution was just a hot fix.

Generated at Thu Feb 08 02:25:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.