AdaCore / AdaCore/gnatstudio

gnatstudio start: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

Open
#199 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
531
Forks
65
PR merge metrics
No merged PRs in 30d

Description

I have build gnatstdio from source using GNAT 15

I was using

env PYTHON=python3.11 ./configure --with-python-sys-prefix --prefix=$HOME/install/ada

to configure and it seems to find what it needs

checking for python version... 3.11
checking for python platform... freebsd16
checking for python default python prefix... /usr/local
checking for python default python exec_prefix... /usr/local
checking for python script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.11/site-packages
checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.11/site-packages
checking for python3.11... /usr/local/bin/python3.11
checking for a version of Python >= '2.1.0'... yes
checking for the distutils Python package... yes
checking for Python include path... -I/usr/local/include/python3.11
checking for Python library path... -L/usr/local/lib -lpython3.11
checking for Python site-packages path... /usr/local/lib/python3.11/site-packages
checking python extra libraries... -lintl -ldl -L/usr/local/lib -lintl -lutil -lm
checking python extra linking flags... -Wl,--export-dynamic
checking consistency of all components of python development environment... yes
checking for pygobject... yes (pkg_resources)

However, when trying to start gnatstudio it bails out with some bogus Python paths:

> env PYTHONPATH=/home/saper/install/ada/share/gnatstudio/support/core gnatstudio 
Python path configuration:
  PYTHONHOME = '/usr/home/saper/install/ada/share/gnatstudio/python'
  PYTHONPATH = '/home/saper/install/ada/share/gnatstudio/support/core:/usr/home/saper/install/ada/share/gnatstudio/python'
  program name = 'gnatstudio'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/usr/home/saper/install/ada/share/gnatstudio/python/lib/python3.11'
  sys._base_executable = '/home/saper/install/ada/bin/gnatstudio'
  sys.base_prefix = '/usr/home/saper/install/ada/share/gnatstudio/python'
  sys.base_exec_prefix = '/usr/home/saper/install/ada/share/gnatstudio/python'
  sys.platlibdir = 'lib'
  sys.executable = '/home/saper/install/ada/bin/gnatstudio'
  sys.prefix = '/usr/home/saper/install/ada/share/gnatstudio/python'
  sys.exec_prefix = '/usr/home/saper/install/ada/share/gnatstudio/python'
  sys.path = [
    '/home/saper/install/ada/share/gnatstudio/support/core',
    '/usr/home/saper/install/ada/share/gnatstudio/python',
    '/usr/home/saper/install/ada/share/gnatstudio/python/lib/python311.zip',
    '/usr/home/saper/install/ada/share/gnatstudio/python/lib/python3.11',
    '/usr/home/saper/install/ada/share/gnatstudio/python/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 0x000022500045a010 (most recent call first):
  <no Python frame>

No matter how I try to manipulate PYTHONPATH it comes back with the message like above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the shown configure command and the gnatstudio entry point, then inspect the reported PYTHONHOME, PYTHONPATH, and sys.path values. Compare the /home and /usr/home installation paths and verify where the Python 3.11 standard library is installed. Done means gnatstudio starts without the init_fs_encoding or missing encodings error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.