cancel
Showing results for 
Search instead for 
Did you mean: 

Running empedPy in KDB+ 4.0 (Linux Ubuntu 18.04)

hakank
New Contributor
Some days ago I downloaded the (on demand) version of KDB+ 4. 0 and wanted to test embedPy but got problems.

I've followed the instructions from https://github.com/KxSystems/embedPy and have tested both by compiling from source (Git version ) and also downloaded the embedPy_linux-1.3.7.tgz from https://github.com/KxSystems/embedPy/releases/tag/1.3.7.

And after that:
- copying p.q and p.k to $HOME/q
- copying p.so to $HOME/q/l64

However, when trying run test.q the following error occurs:

$ taskset --cpu-list 0-15 ~/q/l64/q test.q
"""
KDB+ 4.0 2020.05.04 Copyright (C) 1993-2020 Kx Systems
l64/ 16(16)core 64092MB hakank jaco 127.0.1.1 EXPIRE 2021.07.23 hakank@gmail.com

'libpython
  [5]  /home/hakank/k/kx/git/KxSystems/embedPy/p.q:12:
 `L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
 .p:(`:./p 2:(`init;2))[L;H]]
    ^
q.p))
"""

The same message occurs when just loading p.k
q)\l p.q
"""
'libpython
  [3]  /home/hakank/k/kx/q64_20200504/p.q:12:
 `L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
 .p:(`:./p 2:(`init;2))[L;H]]
    ^
q.p))
"""

Note: My $HOME/q directory is a symbolic link from /home/hakank/k/kx/q64_20200504/ , hence the perhaps strange directory in the above message.

My Linux version is Ubuntu 18.04.4LTS.

My Python versions are:
- python: v2.7.17
- python3: v3.7.6

According to apt the python-dev packages are installed from python 2.7 and python 3.7.

I've also tested PyQ and it seems to work, but I uninstalled it since it have a p.k which conflicts with embedPy (as mentioned on the embedPy page).

Is there something I have missed to install or set up? I'm not proficient in q  to interpret the error messages...

4 REPLIES 4

dodonoghue
New Contributor
This is a problem that sometimes occurs when embedPy is installed from source. Instructions on how to fix the issue can be found here https://code.kx.com/q/ml/embedpy/faq/#installing-embedpy-on-system-with-python-installed-from-source.  Hopefully that should fix the issue. 

Kind Regards,
Diane 

creilly
New Contributor
Hi,

This error is raised when kdb+ can't find the shared python object specified in the variable .p.L (This value can be determined by entering it in the debugger when p.q fails to load).

q)\l p.q
'libpython
  [2]  ~/q/p.q:9:
 `L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
 .p:(`:./p 2:(`init;2))[L;H]]
    ^
  [0]  (<load>)

  ).p.L
"/usr/lib/libpython3.7m.so.1.0"

A symlink to the files actual location from this directory is usually sufficient.

pi@raspberrypi:/usr/lib $ ll libpython3.7m.so.1.0
lrwxrwxrwx 1 root root 49 May 30 09:42 libpython3.7m.so.1.0 -> /usr/lib/arm-linux-gnueabihf/libpython3.7m.so.1.0
pi@raspberrypi:/usr/lib $ q p.q
KDB+ 3.5 2017.10.11 Copyright (C) 1993-2017 Kx Systems
l32/ 4()core 1939MB pi raspberrypi 127.0.1.1 NONEXPIRE

q)

Note, I'm running this on an ARM os using kdb+ 3.5, but I expect this to be the same issue.

Hope this helps,
Cillian



hakank
New Contributor
The issue at https://code.kx.com/q/ml/jupyterq/faq/ was spot on: My Python version 3.7 was indeed manually installed but was not compiled with ./configure --enable-shared .
After I sym linked the libpython3.7m.so to the proper place,  embedPy works .

Thanks to all!

Now I'm trying to get jupyterq to work...

/Hakan

cmccarthy1
New Contributor III
New Contributor III
Hi,

The libpython error as displayed in the output of your loading of p.q indicates that embedPy has not been able to access the libpython.so that is required to initialise the interface.

As outlined here https://code.kx.com/q/ml/embedpy/faq/ this error is commonly a result of issues in the setup of python or alternatively in the accessing of an incorrect version of python. Please follow the steps as outlined in the FAQ and if you are still having issues revert here.

Kind regards,

Conor