NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.44k stars 13.65k forks source link

qtile: locale.Error: unsupported locale setting #41784

Closed steveej closed 4 years ago

steveej commented 6 years ago

Issue description

I have qtile 0.11.1 pulled in via the unstable channel at the commit seen below in the technical details section. It throws the following error on my system:

$ qtile --version
Traceback (most recent call last):
  File "/nix/store/0rhv2icj7zfbccd8wjma6m5lql5wk6ds-qtile-0.10.7/bin/..qtile-wrapped-wrapped", line 8, in <module>
    from libqtile.scripts.qtile import main
  File "/nix/store/0rhv2icj7zfbccd8wjma6m5lql5wk6ds-qtile-0.10.7/lib/python2.7/site-packages/libqtile/scripts/qtile.py", line 30, in <module>
    locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())
  File "/nix/store/l9j2jsc9flrbmpf799nw9wdq59gpwms8-python-2.7.14/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

In my system configuration I have

  i18n = {
    consoleFont = "lat9w-16";
    defaultLocale = "en_US.UTF-8";
  };

set.

Steps to reproduce

  1. set the locales as described above
  2. install qtile from the unstable channel described below
  3. attempt to run qtile

Technical details

EDIT: I just noticed the above was produced with qtile 0.10.7 due to a typo in the overrides

(...)
      gitpkgs = import /home/steveej/src/github/NixOS/nixpkgs {};
(...)
    packageOverrides = pkgs: with pkgs; {
      qtile = gitpkgs.qtile;
(...)

The fork point of my local repository is currently: 9292bdba6c5bbe49d97b3737b4fbff42d28256ea which is before the version bump of qtile which I had suspected to be the culprit.

So my actual question is, if it's not the recent version bump of qtile, what else could be breaking this?

dpaetzel commented 6 years ago

I get a very similar error when using khard 0.12.2.

$ khard
Traceback (most recent call last):
  File "/nix/store/x1nrik6n21zsggqdlb7xxpx17bnlky5y-khard-0.12.2/bin/.khard-wrapped", line 12, in <module>
    sys.exit(main())
  File "/nix/store/x1nrik6n21zsggqdlb7xxpx17bnlky5y-khard-0.12.2/lib/python3.6/site-packages/khard/khard.py", line 1478, in main
    args = parse_args()
  File "/nix/store/x1nrik6n21zsggqdlb7xxpx17bnlky5y-khard-0.12.2/lib/python3.6/site-packages/khard/khard.py", line 1454, in parse_args
    config = Config(args.config)
  File "/nix/store/x1nrik6n21zsggqdlb7xxpx17bnlky5y-khard-0.12.2/lib/python3.6/site-packages/khard/config.py", line 48, in __init__
    locale.setlocale(locale.LC_ALL, '')
  File "/nix/store/p1bp0kpmxi7nzrla7n7c4waqic0a2myk-python3-3.6.4/lib/python3.6/locale.py", line 598, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Any help would be much appreciated!

dpaetzel commented 6 years ago

After reading #38991 (especially, this comment) I uninstalled khard from my user environment and added it to my environment.systemPackages which solved the issue for me.

kamilchm commented 6 years ago

I have qtile installed in environment.systemPackages and it works fine (Linux 4.16.11, NixOS, 18.09.git.0e326d3 (Jellyfish)):

$ qtile --version
0.11.1
steveej commented 6 years ago

I have qtile installed in environment.systemPackages and it works fine (Linux 4.16.11, NixOS, 18.09.git.0e326d3 (Jellyfish)):

Installing it in my systemPackages is not an option for me since I use home-manager. I just checked after this long while and the situation is still the same:

$ qtile --version
Traceback (most recent call last):
  File "/nix/store/226yd49pimppq30yr9cx9s4wm0qcskgn-qtile-0.12.0/bin/..qtile-wrapped-wrapped", line 8, in <module>
    from libqtile.scripts.qtile import main
  File "/nix/store/226yd49pimppq30yr9cx9s4wm0qcskgn-qtile-0.12.0/lib/python2.7/site-packages/libqtile/scripts/qtile.py", line 31, in <module>
    locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())  # type: ignore
  File "/nix/store/9qjc0d5557h3dkpsvfq98b2k96lnb6pw-python-2.7.15/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

I assume we can workaround this by exporting LOCALE_ARCHIVE as described here https://github.com/NixOS/nixpkgs/issues/38991#issuecomment-400657551

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
steveej commented 4 years ago

I'm no longer experiencing this issue.