Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

7.x: Running python on QNX Target
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: Python
  • SDP: 7.0.0, 7.1.0
  • Target: X86_64, aarch64
________________________________________________________________________

Issue
..............................................................................................................................................

Your goal is to use python on your QNX Target. You include python resources in the QNX IFS (or on a storage device available on the target).

When you boot the target and attempt to run python, it fails.

OBSERVED ERROR:

# python3
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/proc/boot/python3'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/aarch64le/usr'
sys.executable = '/proc/boot/python3'
sys.prefix = '/usr'
sys.exec_prefix = '/aarch64le/usr'
sys.path = [
'/usr/lib/python38.zip',
'/usr/lib/python3.8',
'/aarch64le/usr/lib/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x0000000000000001 (most recent call first):
<no Python frame>


________________________________________________________________________

Solution / Recommendation
________________________________________________________________________

In addition to the python binary, you need the python backend files which can be found in the SDP.
Depending on the QPKGs installed on your dev host, the required files are located in:
  • Python QPKGs for 7.0: <qnx700_install_root>/target/qnx7/aarch64le/usr/lib/python2.7
  • For older Python QPKGs for 7.1: <qnx710_install_root>/target/qnx7/aarch64le/usr/lib/python3.8
  • For newer Python QPKGs for 7.1 (~Nov 2021 and onward): <qnx710_install_root>/target/qnx7/usr/lib/python3.8

NOTE 1: python expects the python files to be on the target in a specific location.
> For 7.1 python3, the target path is /usr/lib/python3.8

NOTE 2: if you add these files from the SDP path to the target image filesystem (IFS), the IFS size becomes too huge to boot. So the best way is to copy this entire directory from the host PC to a non-volatile memory in the target, such as SD card.


________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.