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

Further problems with locale #519

Open
pp-mo opened this issue Nov 12, 2024 · 1 comment
Open

Further problems with locale #519

pp-mo opened this issue Nov 12, 2024 · 1 comment
Labels
New: Issue Highlight a new community raised "generic" issue Type: Bug

Comments

@pp-mo
Copy link
Member

pp-mo commented Nov 12, 2024

As reported here in the context of iris-esmf-regrid,
the current save - modify - restore code for the locale setting it seems does not always work correctly.
This was reported in #435, fixed by #436, introduced in v3.3.0

Not clear yet what is actually wrong, but for iris-esmf-regrid it seems to occur specifically in readthedocs builds.
The case given should hopefully point to it.

Detail

ReadTheDocs log captured here from a ReadTheDocs build test (i.e. its error log) on commit SciTools/iris-esmf-regrid@b5edcd7 , in SciTools/iris-esmf-regrid#431.
Since we can't expect that record to persist

python -m sphinx -T -b html -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html Running Sphinx v8.1.3

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/esmf_regrid-0.12.dev0-py3.10.egg/esmf_regrid/init.py", line 11, in
import iris.mesh as _imesh
ModuleNotFoundError: No module named 'iris.mesh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/config.py", line 529, in eval_config_file
exec(code, namespace) # NoQA: S102
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/checkouts/431/docs/src/conf.py", line 34, in
from esmf_regrid import version as esmf_r_version
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/esmf_regrid-0.12.dev0-py3.10.egg/esmf_regrid/init.py", line 14, in
import iris.experimental.ugrid as _imesh
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/experimental/ugrid/init.py", line 18, in
from .load import PARSE_UGRID_ON_LOAD, load_mesh, load_meshes
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/experimental/ugrid/load.py", line 22, in
from ...coords import AuxCoord
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/coords.py", line 23, in
from iris.common import (
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/common/init.py", line 9, in
from .mixin import *
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/common/mixin.py", line 10, in
import cf_units
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/cf_units/init.py", line 198, in
with suppress_errors(), c_locale():
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/contextlib.py", line 142, in exit
next(self.gen)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/cf_units/init.py", line 191, in c_locale
locale.setlocale(locale.LC_NUMERIC, lc_numeric)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/locale.py", line 620, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/cmd/build.py", line 496, in build_main
app = Sphinx(
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/application.py", line 238, in init
self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/config.py", line 316, in read
namespace = eval_config_file(filename, tags)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/config.py", line 542, in eval_config_file
raise ConfigError(msg % traceback.format_exc()) from exc
sphinx.errors.ConfigError: There is a programmable error in your configuration file:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/esmf_regrid-0.12.dev0-py3.10.egg/esmf_regrid/init.py", line 11, in
import iris.mesh as _imesh
ModuleNotFoundError: No module named 'iris.mesh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/config.py", line 529, in eval_config_file
exec(code, namespace) # NoQA: S102
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/checkouts/431/docs/src/conf.py", line 34, in
from esmf_regrid import version as esmf_r_version
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/esmf_regrid-0.12.dev0-py3.10.egg/esmf_regrid/init.py", line 14, in
import iris.experimental.ugrid as _imesh
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/experimental/ugrid/init.py", line 18, in
from .load import PARSE_UGRID_ON_LOAD, load_mesh, load_meshes
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/experimental/ugrid/load.py", line 22, in
from ...coords import AuxCoord
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/coords.py", line 23, in
from iris.common import (
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/common/init.py", line 9, in
from .mixin import *
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/common/mixin.py", line 10, in
import cf_units
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/cf_units/init.py", line 198, in
with suppress_errors(), c_locale():
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/contextlib.py", line 142, in exit
next(self.gen)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/cf_units/init.py", line 191, in c_locale
locale.setlocale(locale.LC_NUMERIC, lc_numeric)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/locale.py", line 620, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/esmf_regrid-0.12.dev0-py3.10.egg/esmf_regrid/init.py", line 11, in
import iris.mesh as _imesh
ModuleNotFoundError: No module named 'iris.mesh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/sphinx/config.py", line 529, in eval_config_file
exec(code, namespace) # NoQA: S102
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/checkouts/431/docs/src/conf.py", line 34, in
from esmf_regrid import version as esmf_r_version
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/esmf_regrid-0.12.dev0-py3.10.egg/esmf_regrid/init.py", line 14, in
import iris.experimental.ugrid as _imesh
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/experimental/ugrid/init.py", line 18, in
from .load import PARSE_UGRID_ON_LOAD, load_mesh, load_meshes
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/experimental/ugrid/load.py", line 22, in
from ...coords import AuxCoord
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/coords.py", line 23, in
from iris.common import (
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/common/init.py", line 9, in
from .mixin import *
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/iris/common/mixin.py", line 10, in
import cf_units
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/cf_units/init.py", line 198, in
with suppress_errors(), c_locale():
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/contextlib.py", line 142, in exit
next(self.gen)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/site-packages/cf_units/init.py", line 191, in c_locale
locale.setlocale(locale.LC_NUMERIC, lc_numeric)
File "/home/docs/checkouts/readthedocs.org/user_builds/iris-esmf-regrid/conda/431/lib/python3.10/locale.py", line 620, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

@pp-mo pp-mo added Type: Bug New: Issue Highlight a new community raised "generic" issue labels Nov 12, 2024
@bouweandela
Copy link
Member

To understand what is going on, it would be useful to print the value that is causing the error. Do you think you could modify the build so it prints that out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New: Issue Highlight a new community raised "generic" issue Type: Bug
Projects
Status: No status
Development

No branches or pull requests

2 participants