<div dir="ltr">Hi Miconda, I managed to compile the app_python3 with my own version of python, thanks to you.<div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(244,71,71)">$</span> ldd /usr/local/lib64/kamailio/modules/app_python3.so</div><div> linux-vdso.so.1 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007ffe57d99000</span>)</div><div> libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca371e000</span>)</div><div> libpython3.7m.so.1.0 => /opt/usr/lib/libpython3.7m.so.1.0 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca33e6000</span>)</div><div> libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca33ac000</span>)</div><div> libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca338b000</span>)</div><div> libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca3386000</span>)</div><div> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca3203000</span>)</div><div> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca3041000</span>)</div><div> /lib64/ld-linux-x86-<span style="color:rgb(181,206,168)">64.</span>so.2 (<span style="color:rgb(86,156,214)">0x</span><span style="color:rgb(181,206,168)">00007f7ca37a6000</span>)</div></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><br></div><div>But the issue remains. I tried printing the PYTHONPATH from python's sys.path with KSR.info when the script loaded</div><div>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</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-size:14px;line-height:19px;white-space:pre"><div>Oct <span style="color:rgb(181,206,168)">6</span> <span style="color:rgb(181,206,168)">18</span>:<span style="color:rgb(181,206,168)">12</span>:<span style="color:rgb(181,206,168)">40</span> sipv222 /usr/local/sbin/kamailio[<span style="color:rgb(181,206,168)">15686</span>]: INFO: <core> [core/kemi.c:<span style="color:rgb(181,206,168)">106</span>]: sr_kemi_core_info(): </div><div><span style="color:rgb(79,193,255)">PYTHONPATH</span>: [<span style="color:rgb(206,145,120)">'/script/file/location'</span>, <span style="color:rgb(206,145,120)">'/lib/python37.zip'</span>, <span style="color:rgb(206,145,120)">'/lib/python3.7'</span>, <span style="color:rgb(206,145,120)">'/lib/python3.7/lib-dynload'</span>,</div><div><span style="color:rgb(206,145,120)">'/root/.local/lib/python3.7/site-packages'</span>, <span style="color:rgb(206,145,120)">'/lib/python3/dist-packages'</span>]</div><br></div></div><div><br></div><div>But when I remove the system python completely, everything is fine as my alternative python is prefered.</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-size:14px;line-height:19px;white-space:pre"><div>Oct <span style="color:rgb(181,206,168)">6</span> <span style="color:rgb(181,206,168)">18</span>:<span style="color:rgb(181,206,168)">13</span>:<span style="color:rgb(181,206,168)">17</span> sipv222 /usr/local/sbin/kamailio[<span style="color:rgb(181,206,168)">15841</span>]: INFO: <core> [core/kemi.c:<span style="color:rgb(181,206,168)">106</span>]: sr_kemi_core_info():</div><div><span style="color:rgb(79,193,255)">PYTHONPATH</span>: [<span style="color:rgb(206,145,120)">'/script/file/location'</span>, <span style="color:rgb(206,145,120)">'/opt/usr/lib/python37.zip'</span>, <span style="color:rgb(206,145,120)">'/opt/usr/lib/python3.7'</span>, <span style="color:rgb(206,145,120)">'/opt/usr/lib/python3.7/lib-dynload'</span>,</div><div><span style="color:rgb(206,145,120)">'/root/.local/lib/python3.7/site-packages'</span>, <span style="color:rgb(206,145,120)">'/opt/usr/lib/python3.7/site-packages'</span>]</div><br></div></div><div><br></div><div>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.</div><div>I tried different alternative python versions, i.e: 3.9, and everything is fine.</div><div><br></div><div>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?</div><div><br></div><div>Thanks again for the quick response.</div><div>rgds,</div><div>Loi Dang Thanh<br></div>Phone : +84. 774.735.448<br></div>Email : <a href="mailto:loi.dangthanh@gmail.com" target="_blank">loi.dangthanh@gmail.com</a><br></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 5, 2022 at 10:05 PM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hello,</p>
<p>kamailio should use the python3 library app_python3 was compiled
with, you should run ldd to see the linking chain, like:</p>
<p>$ ldd src/modules/app_python3/app_python3.so</p>
<p> linux-vdso.so.1 (0x00007ffe8336a000)<br>
libpython3.9.so.1.0 =>
/lib/x86_64-linux-gnu/libpython3.9.so.1.0 (0x00007fa4d2f54000)<br>
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
(0x00007fa4d2d7f000)<br>
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1
(0x00007fa4d2d50000)<br>
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1
(0x00007fa4d2d33000)<br>
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007fa4d2d11000)<br>
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
(0x00007fa4d2d0b000)<br>
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1
(0x00007fa4d2d04000)<br>
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
(0x00007fa4d2bc0000)<br>
/lib64/ld-linux-x86-64.so.2 (0x00007fa4d3578000)<br>
</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div>On 05.10.22 10:05, Lợi Đặng wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">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.
<div><br>
</div>
<div>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.<br>
<div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Any help would be appreciated.</div>
<div><br clear="all">
<div>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>rgds,</div>
<div>Loi Dang Thanh<br>
</div>
Phone : +84. 774.735.448<br>
</div>
Email : <a href="mailto:loi.dangthanh@gmail.com" target="_blank">loi.dangthanh@gmail.com</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
* <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
Nov 7-10, 2022 (Europe Timezone)
* <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
</div>
</blockquote></div>