Python 3.8 failed to load shared libraries "libpython3.8.so.1.0" (F4-210)

Discussion on apps, protocols, APIs, specifications, and more. You are welcome to join us as a TOS app developer!
Post Reply
User avatar
MiniChaKal
Posts: 3
Joined: 09 Aug 2023, 23:10

Python 3.8 failed to load shared libraries "libpython3.8.so.1.0" (F4-210)

Post by MiniChaKal »

Hi
I want to run a Python 3.8 script on my F4-210. I installed Python from the "Applications Store" with Cron_okm to make a reboot cron action to start the Python script every reboots

To debug it, it run with this command : */2 * * * * MyUser /usr/local/bin/python3.8 /mnt/md0/MyCoolSharing/WebServer/main.py >> /mnt/md0/MyCoolSharing/WebServer/log_api.log 2>&1

Inside the log file I got :
/usr/local/bin/python3.8: error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory

It's a Flask server, So Python 3.8 is required.
I found the file at "/mnt/md0/application/lib/" with a SSH connexion.

How I can fix this issue ? Will a Docker container fix it (And how to do it to run my script and save files on my disks) ?
Note :
In my SSH connexion I can do "python /mnt/md0/MyCoolSharing/WebServer/main.py" and I run. Why the CRON don't found the required Python library ?

Any help appreciated !
User avatar
lesliewang
Posts: 2
Joined: 07 Mar 2024, 17:22

Re: Python 3.8 failed to load shared libraries "libpython3.8.so.1.0" (F4-210)

Post by lesliewang »

Hello,
First, I think you should update the LD_LIBRARY_PATH: The LD_LIBRARY_PATH environment variable is used by the system to locate shared libraries. You can try updating it to include the directory where the libpython3.8.so.1.0 library is located. Run the following command in your SSH session:

Code: Select all

bash
export LD_LIBRARY_PATH=/mnt/md0/application/lib:$LD_LIBRARY_PATH
This command adds the "/mnt/md0/application/lib" directory to the LD_LIBRARY_PATH.
Secondly, you can try modifying the Cron Job. Update your cron job command to include the updated LD_LIBRARY_PATH. Modify your cron job entry to something like this:

Code: Select all

bash
*/2 * * * * MyUser env LD_LIBRARY_PATH=/mnt/md0/application/lib /usr/local/bin/python3.8 /mnt/md0/MyCoolSharing/WebServer/main.py >> /mnt/md0/MyCoolSharing/WebServer/log_api.log 2>&1
This command sets the LD_LIBRARY_PATH environment variable before executing the Python script.
User avatar
lesliewang
Posts: 2
Joined: 07 Mar 2024, 17:22

Re: Python 3.8 failed to load shared libraries "libpython3.8.so.1.0" (F4-210)

Post by lesliewang »

Hope that my answer is useful for you. fnaf 2
Post Reply

Return to “Developer Discussion Room”