Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Python 3.10 builds are not working with PyOxidizer #557

Closed
Cellebyte opened this issue Apr 22, 2022 · 7 comments
Closed

[Bug] Python 3.10 builds are not working with PyOxidizer #557

Cellebyte opened this issue Apr 22, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@Cellebyte
Copy link

Cellebyte commented Apr 22, 2022

Steps to reproduce

Hey looks like there is an issue with the python-standalone build.
Between version 3.9 and 3.10.
I don't know if it is an issue with pyOxidizer or the building tools.

mkdir -p blub
python3.10 -m venv .venv 
source .venv/bin/activate
pip install pyoxidizer
cd ..
pyoxidizer init-config-file blub
cd blub
# add python3.10 to pyoxidizer.bzl
vim pyoxidizer.bzl # dist = default_python_distribution(python_version = "3.10") and save
pyoxidizer run

Output Python 3.9

Python 3.9.10 (main, Feb 27 2022, 23:33:24) 
[Clang 13.0.1 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Output Python 3.10

Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = '/home/cellebyte/git/dttechnik/blub/build/x86_64-unknown-linux-gnu/debug/install'
  program name = '/home/cellebyte/git/dttechnik/blub/./build/x86_64-unknown-linux-gnu/debug/install/blub'
  isolated = 1
  environment = 0
  user site = 0
  import site = 1
  sys._base_executable = '/home/cellebyte/git/dttechnik/blub/./build/x86_64-unknown-linux-gnu/debug/install/blub'
  sys.base_prefix = '/install'
  sys.base_exec_prefix = '/install'
  sys.platlibdir = 'lib'
  sys.executable = '/home/cellebyte/git/dttechnik/blub/./build/x86_64-unknown-linux-gnu/debug/install/blub'
  sys.prefix = '/install'
  sys.exec_prefix = '/install'
  sys.path = [
    '/home/cellebyte/git/dttechnik/blub/build/x86_64-unknown-linux-gnu/debug/install',
    '/install/lib/python310.zip',
    '/install/lib/python3.10',
    '/install/lib/lib-dynload',
  ]
error instantiating embedded Python interpreter: during initializing Python core: init_fs_encoding: failed to get the Python codec of the filesystem encoding
error: cargo run failed
@Cellebyte Cellebyte changed the title [Bug] Python 3.10 builds are not working. [Bug] Python 3.10 builds are not working with PyOxidizer Apr 22, 2022
@indygreg
Copy link
Owner

That init_fs_encoding: failed to get the Python codec of the filesystem encoding is the error message that Python spews when it tries to import some low-level stdlib module during startup but it can't find the files. This error is described at https://pyoxidizer.readthedocs.io/en/latest/pyoxidizer_rust_generic_embedding.html#embed-python-with-pyo3.

We should not see this issue with PyOxidizer unless the pyoxidizer.bzl is somehow doing something that would cause it.

Do you have a pyoxidizer.bzl we could look it?

And since this looks like a PyOxidizer issue, I'm going to attempt to transfer the issue there...

@indygreg indygreg transferred this issue from indygreg/python-build-standalone Apr 29, 2022
@Cellebyte
Copy link
Author

Cellebyte commented Apr 30, 2022

@indygreg as mentioned above {ups will update the reproduce steps} I just created a init config file with the latest PyOxidizer release and changed python_version to version 3.10

@Cellebyte
Copy link
Author

@indygreg I updated the instructions so that you can reproduce it.

@indygreg indygreg added the bug Something isn't working label May 12, 2022
@indygreg
Copy link
Owner

This might be due to PyO3/pyo3#2370. The Rust struct representing PyConfig is missing a field. So all offsets after the missing field are wrong, leading to a corrupted struct from the perspective of CPython. This can result in crashes or wrong behavior.

ThatNerdSquared added a commit to ThatNerdSquared/peregrine that referenced this issue May 13, 2022
- not currently possible to switch due to [PyOxidizer bug](indygreg/PyOxidizer#557)
@ThatNerdSquared
Copy link

Bumping this — seems like the relevant PyO3 bug has been fixed, if I've been following the right PRs? Would love to switch to PyOxidizer from PyInstaller as can be seen from my referenced commit above, but the broken 3.10 builds are holding me back from the switch.

Thanks for your work on PyOxidizer, it looks great from what I've played with so far 👍

@Cellebyte
Copy link
Author

@ThatNerdSquared I think you need to wait for the next release or build PyOxidizer from the main branch

@Cellebyte
Copy link
Author

Release for
PyOxidizer v0.22.0 fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants