question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python broke in v2.5.0

See original GitHub issue

The release v2.5.0 broke running Python in GH Actions with under msys, it worked in 2.4.2.

Our workflow: https://github.com/cocotb/cocotb/blob/1123973ed6979f89b8e1cb8785d5ae7c425d2908/.github/workflows/regression-tests.yml#L334-L371

Python aborts execution right after start with the following message:

Python path configuration:
  PYTHONHOME = 'D:/a/_temp/msys/msys64/mingw64'
  PYTHONPATH = (not set)
  program name = 'D:/a/_temp/msys64/mingw64/bin/python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'D:/a/_temp/msys64/mingw64/bin/python.exe'
  sys.base_prefix = 'D:/a/_temp/msys/msys64/mingw64'
  sys.base_exec_prefix = 'D:/a/_temp/msys/msys64/mingw64'
  sys.platlibdir = 'lib'
  sys.executable = 'D:/a/_temp/msys64/mingw64/bin/python.exe'
  sys.prefix = 'D:/a/_temp/msys/msys64/mingw64'
  sys.exec_prefix = 'D:/a/_temp/msys/msys64/mingw64'
  sys.path = [
    'D:/a/_temp/msys/msys64/mingw64/lib/python39.zip',
    'D:/a/_temp/msys/msys64/mingw64/lib/python3.9',
    'D:/a/_temp/msys/msys64/mingw64/lib/python3.9/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'

There’s much more information available at https://github.com/cocotb/cocotb/issues/2739

The most likely reason for this change in behavior seems to be like https://github.com/msys2/setup-msys2/pull/163. Do you have any idea what’s going on?

Note PYTHONHOME is referring to (as far as I read the PR) the “old” installation path, ‘D:/a/_temp/msys/msys64/mingw64’, while the Python binary is in the new installation path.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lazkacommented, Oct 17, 2021

Ah, I see. Or we could use a different path in autobuild.

0reactions
ktbarrettcommented, Nov 6, 2021

@lazka Read this: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME. prefix and PYTHONHOME should be one in the same. We put that line in place based on the following recommendation. PYTHONHOME and the path to the Python standard library can be deduced from the Python executable, but apparently not necessarily from libpython, so you are expected to help it out. The only way we can do that is by invoking Python and asking it what it thinks PYTHONHOME should be.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — Python 3.11.1 documentation
gh-96268: Loading a file with invalid UTF-8 will now report the broken character at the ... source , track and wbr as empty...
Read more >
Python break during install - CryoSPARC Discuss
I'm trying to install cryoSparc on a new box for us. However, I'm getting a new error during install that I don't know...
Read more >
How can I do a line break (line continuation) in Python?
The same effect can be obtained using explicit line break: a = '1' + '2' + '3' + \ '4' + '5'. Note...
Read more >
Release notes — pikepdf 2.15.1 documentation - Read the Docs
This description includes changes in v2.0 beta releases. Breaking changes. We now require at least these versions or newer: - Python 3.6 -...
Read more >
Python program to split and join a string - GeeksforGeeks
Python program to Split a string based on a delimiter and join the string ... 5. Python String Methods | Set 2 (len,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found