# Running empedPy in KDB+ 4.0 (Linux Ubuntu 18.04)

**URL:** <https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [July 31, 2020, 8:23am UTC](https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044 "2020-07-31T08:23:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hakank1](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hakank1](https://forum.kx.com/u/hakank1)\
**Post date:** [July 31, 2020, 8:23am UTC](https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044/1 "2020-07-31T08:23:00Z")

</div>

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](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](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](mailto:hakank@gmail.com)

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

The same message occurs when just loading p.k

q)\l p.q

“”"  
'libpython  
&nbsp; [3]&nbsp; /home/hakank/k/kx/q64\_20200504/p.q:12:  
&nbsp;`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$“:”,M;L::M]];  
&nbsp;.p:(`:./p 2:(`init;2))[L;H]]  
&nbsp;&nbsp;&nbsp; ^  
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&nbsp; to interpret the error messages…

---

<div class="post-metadata">

**Author:** ![User7](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@User7](https://forum.kx.com/u/User7)\
**Post date:** [July 31, 2020, 2:46pm UTC](https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044/2 "2020-07-31T14:46:00Z")

</div>

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

Kind Regards,

Diane&nbsp;

---

<div class="post-metadata">

**Author:** ![User7](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@User7](https://forum.kx.com/u/User7)\
**Post date:** [July 31, 2020, 2:48pm UTC](https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044/3 "2020-07-31T14:48:00Z")

</div>

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  
&nbsp; [2]&nbsp; ~/q/p.q:9:  
&nbsp;`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$“:”,M;L::M]];  
&nbsp;.p:(`:./p 2:(`init;2))[L;H]]  
&nbsp; &nbsp; ^  
&nbsp; [0] &nbsp;(\<load\>)

&nbsp; ).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

---

<div class="post-metadata">

**Author:** ![cmccarthy11](https://avatars.discourse-cdn.com/v4/letter/c/58f4c7/32.png) [@cmccarthy11](https://forum.kx.com/u/cmccarthy11)\
**Post date:** [July 31, 2020, 2:51pm UTC](https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044/4 "2020-07-31T14:51:00Z")

</div>

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&nbsp;https://code.kx.com/q/ml/embedpy/faq/&nbsp;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

---

<div class="post-metadata">

**Author:** ![hakank1](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hakank1](https://forum.kx.com/u/hakank1)\
**Post date:** [July 31, 2020, 4:47pm UTC](https://forum.kx.com/t/running-empedpy-in-kdb-4-0-linux-ubuntu-18-04/12044/5 "2020-07-31T16:47:00Z")

</div>

The issue at [https://code.kx.com/q/ml/jupyterq/faq/](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,&nbsp; embedPy works .

Thanks to all!

Now I’m trying to get jupyterq to work…

/Hakan
