pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

Error occurred when distributing build artifacts

Open Poseidon-fan opened this issue 2 months ago • 0 comments

I'm writing a Rust binary tool, and use pyo3 to call python code as plugin.

when I build the program on github ci, and download it to my local machine, it throws err:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/install/lib/python3.11'
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/install'
  sys.base_exec_prefix = '/install'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/install'
  sys.exec_prefix = '/install'
  sys.path = [
    '/install/lib/python311.zip',
    '/install/lib/python3.11',
    '/install/lib/python3.11/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 0x00007f14e440a080 (most recent call first):
  <no Python frame>

I think these messages should not be built into binary artifacts? It should determine which python env to use at run time just like when I typed the line of code python main.py? Otherwise, programs compiled with pyo3 are really poor portable.

Poseidon-fan avatar Nov 08 '25 12:11 Poseidon-fan