Hi Miconda, I managed to compile the app_python3 with my own version of python, thanks to you.
$ ldd /usr/local/lib64/kamailio/modules/app_python3.so linux-vdso.so.1 (0x00007ffe57d99000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7ca371e000) libpython3.7m.so.1.0 => /opt/usr/lib/libpython3.7m.so.1.0 (0x 00007f7ca33e6000) libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f7ca33ac000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7ca338b000 ) libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f7ca3386000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7ca3203000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7ca3041000) /lib64/ld-linux-x86-64.so.2 (0x00007f7ca37a6000)
But the issue remains. I tried printing the PYTHONPATH from python's sys.path with KSR.info when the script loaded When the system python3 (from repo) is on the host, PYTHONPATH from sys.path prefers it. and ModuleNotFoundError will raise as i do not install anything on the system's Oct 6 18:12:40 sipv222 /usr/local/sbin/kamailio[15686]: INFO: <core> [core/kemi.c:106]: sr_kemi_core_info(): PYTHONPATH: ['/script/file/location', '/lib/python37.zip', '/lib/python3.7', '/lib/python3.7/lib-dynload', '/root/.local/lib/python3.7/site-packages', '/lib/python3/dist-packages']
But when I remove the system python completely, everything is fine as my alternative python is prefered. Oct 6 18:13:17 sipv222 /usr/local/sbin/kamailio[15841]: INFO: <core> [core/kemi.c:106]: sr_kemi_core_info(): PYTHONPATH: ['/script/file/location', '/opt/usr/lib/python37.zip', '/opt/usr/lib/python3.7', '/opt/usr/lib/python3.7/lib-dynload', '/root/.local/lib/python3.7/site-packages', '/opt/usr/lib/python3.7/site-packages']
This only happens when minor values of both python versions are the same, host 3.7.3, alternate 3.7.9 so they're both python3.7. I tried different alternative python versions, i.e: 3.9, and everything is fine.
So my qns is how to use my alternate python library without moving it to a different/higher minor version or removing the system python?
Thanks again for the quick response. rgds, Loi Dang Thanh Phone : +84. 774.735.448 Email : loi.dangthanh@gmail.com
On Wed, Oct 5, 2022 at 10:05 PM Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
kamailio should use the python3 library app_python3 was compiled with, you should run ldd to see the linking chain, like:
$ ldd src/modules/app_python3/app_python3.so
linux-vdso.so.1 (0x00007ffe8336a000) libpython3.9.so.1.0 => /lib/x86_64-linux-gnu/libpython3.9.so.1.0
(0x00007fa4d2f54000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa4d2d7f000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fa4d2d50000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fa4d2d33000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa4d2d11000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa4d2d0b000) libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fa4d2d04000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa4d2bc0000) /lib64/ld-linux-x86-64.so.2 (0x00007fa4d3578000)
Cheers, Daniel On 05.10.22 10:05, Lợi Đặng wrote:
Hi all, regarding KEMI with python3, how to specify the python instance we're going to use instead of the system's? i.e: virtual environment or alternative installation of python3.
Asking as I'm having existing code running on a version which does not match the system's, and upgrading system's to the specific version is not feasible.
I tried specifying the python3 instance in src/modules/app_python3/Makefile but it seems only to help with the build, later the system python is used when kamailio starts.
Any help would be appreciated.
rgds, Loi Dang Thanh Phone : +84. 774.735.448 Email : loi.dangthanh@gmail.com
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Online Nov 7-10, 2022 (Europe Timezone)