python36Packages.python-jose fails with ascii codec error which breaks jupyter

I’m stumped: how do I debug this? I’ve updated to the newest on unstable, and I’ve changed nothing about python or python-jose.

[henry@watson:~]$ nix-shell -p python36Packages.python-jose        
these derivations will be built:
  /nix/store/mcncvdwadrq1335bwy279dg7q0sxhvhp-python3.6-rsa-4.0.drv
  /nix/store/p1cj1fqx9icr1sh0p3gqy85w2h5wclm7-python3.6-ecdsa-0.13.drv
  /nix/store/pifmbmqallj7jkl3ar1wv8nqyfzq08hr-python3.6-python-jose-3.0.1.drv
these paths will be fetched (7.42 MiB download, 30.08 MiB unpacked):
  /nix/store/07nhqaa46xrz9pp0ml5fqr6s3jp8hqcg-python3.6-traceback2-1.4.0
  /nix/store/16lfn103sh7phfgdf0msm6sl7lswhlmd-python3.6-unittest2-1.1.0
  /nix/store/1j0f3iysq5v8clkaipagyk42xis8q9sc-python3.6-funcsigs-1.0.2
  /nix/store/3jpi73hwk4sljmd2c82fh76cd8jqb4ji-python3.6-more-itertools-4.3.0
  /nix/store/3minpcn2dmrm1sxlhgh6p2zc1wwi8vgh-python3.6-pycrypto-3.7.0
  /nix/store/3plrg0h14rsfl2kqwwgz9rz4hzbqk3ci-python3.6-coverage-4.5.2
  /nix/store/46yif6qc2adw3lxzm1c61vgjrgcf4sr7-python3.6-cffi-1.11.5-dev
  /nix/store/47ww1m1kzd0902a6427cchk38c2liznn-python3.6-six-1.11.0
  /nix/store/7iq0h4vzflp0v32aiks6q885ma82pvf8-python3.6-pycryptodome-3.7.0
  /nix/store/87m1isbna0s4qn01s26mpqwvn0qjzh97-python3.6-pbr-5.1.1
  /nix/store/98mvz0zv1mwdb8454wr151nrvrbxjzjv-python3.6-pyasn1-0.4.4
  /nix/store/9lm42kidqvv571dvpbnvyapqls8awmhd-python3.6-packaging-18.0
  /nix/store/ap45zlwknrk2slc5w6rqzw570zxmkdg3-python3.6-pytest-cov-2.6.0
  /nix/store/bjcgin4w3s43rk3g77bfv86n2wmgzd80-source
  /nix/store/c093a23j9cg3wyd03whgq2jpqb4c35bv-python3.6-pyparsing-2.3.0
  /nix/store/cagl4kffya32mbwyjk3cgi89cny389h9-python3.6-cryptography-2.3.1-dev
  /nix/store/h1jnn0kg8n7ij9ivhyz83nnpbaqhlhiy-python3.6-pytest-3.9.3
  /nix/store/jfn3wr3j8ypgnn9wz0z2vyiffm73yl3i-python3.6-py-1.7.0
  /nix/store/k55zcamc0wr9l37c3qpb9hkijs2khn04-python3.6-mock-2.0.0
  /nix/store/kkzspd66bjjq1269l2ps9h3gy4z7jsb5-python3.6-future-0.17.1
  /nix/store/m0l0pw2im1bzvsmvwf3gy0ar5cl8mp85-python3.6-pycparser-2.19
  /nix/store/n6sjz4ja0i64yp90bv7zrbq5cfrh50kx-python3.6-pytest-runner-4.2
  /nix/store/p544r363km359dbrvcdnvf98pzbrbiz5-python3.6-idna-2.7
  /nix/store/sr3sfbynmrblrn76w0784a2jfn2rj54y-python3.6-linecache2-1.0.0
  /nix/store/wlxy6srgqbfs1wwcy9q9yqm0kw9ys9cf-python3.6-pluggy-0.8.0
copying path '/nix/store/bjcgin4w3s43rk3g77bfv86n2wmgzd80-source' from 'https://cache.nixos.org'...
copying path '/nix/store/kkzspd66bjjq1269l2ps9h3gy4z7jsb5-python3.6-future-0.17.1' from 'https://cache.nixos.org'...
copying path '/nix/store/n6sjz4ja0i64yp90bv7zrbq5cfrh50kx-python3.6-pytest-runner-4.2' from 'https://cache.nixos.org'...
copying path '/nix/store/47ww1m1kzd0902a6427cchk38c2liznn-python3.6-six-1.11.0' from 'https://cache.nixos.org'...
copying path '/nix/store/3plrg0h14rsfl2kqwwgz9rz4hzbqk3ci-python3.6-coverage-4.5.2' from 'https://cache.nixos.org'...
copying path '/nix/store/p544r363km359dbrvcdnvf98pzbrbiz5-python3.6-idna-2.7' from 'https://cache.nixos.org'...
copying path '/nix/store/wlxy6srgqbfs1wwcy9q9yqm0kw9ys9cf-python3.6-pluggy-0.8.0' from 'https://cache.nixos.org'...
copying path '/nix/store/jfn3wr3j8ypgnn9wz0z2vyiffm73yl3i-python3.6-py-1.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/1j0f3iysq5v8clkaipagyk42xis8q9sc-python3.6-funcsigs-1.0.2' from 'https://cache.nixos.org'...
copying path '/nix/store/sr3sfbynmrblrn76w0784a2jfn2rj54y-python3.6-linecache2-1.0.0' from 'https://cache.nixos.org'...
copying path '/nix/store/87m1isbna0s4qn01s26mpqwvn0qjzh97-python3.6-pbr-5.1.1' from 'https://cache.nixos.org'...
copying path '/nix/store/3jpi73hwk4sljmd2c82fh76cd8jqb4ji-python3.6-more-itertools-4.3.0' from 'https://cache.nixos.org'...
copying path '/nix/store/98mvz0zv1mwdb8454wr151nrvrbxjzjv-python3.6-pyasn1-0.4.4' from 'https://cache.nixos.org'...
copying path '/nix/store/m0l0pw2im1bzvsmvwf3gy0ar5cl8mp85-python3.6-pycparser-2.19' from 'https://cache.nixos.org'...
copying path '/nix/store/7iq0h4vzflp0v32aiks6q885ma82pvf8-python3.6-pycryptodome-3.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/c093a23j9cg3wyd03whgq2jpqb4c35bv-python3.6-pyparsing-2.3.0' from 'https://cache.nixos.org'...
building '/nix/store/p1cj1fqx9icr1sh0p3gqy85w2h5wclm7-python3.6-ecdsa-0.13.drv'...
copying path '/nix/store/h1jnn0kg8n7ij9ivhyz83nnpbaqhlhiy-python3.6-pytest-3.9.3' from 'https://cache.nixos.org'...
copying path '/nix/store/k55zcamc0wr9l37c3qpb9hkijs2khn04-python3.6-mock-2.0.0' from 'https://cache.nixos.org'...
unpacking sources
unpacking source archive /nix/store/i0g7f6x9wm7qrk799181csrwfxy9l8rq-ecdsa-0.13.tar.gz
source root is ecdsa-0.13
setting SOURCE_DATE_EPOCH to timestamp 1423333576 of file ecdsa-0.13/ecdsa/_version.py
patching sources
configuring
building
copying path '/nix/store/07nhqaa46xrz9pp0ml5fqr6s3jp8hqcg-python3.6-traceback2-1.4.0' from 'https://cache.nixos.org'...
running bdist_wheel
The [wheel] section is deprecated. Use [bdist_wheel] instead.
running build
got version from file /build/ecdsa-0.13/ecdsa/_version.py {'version': '0.13', 'full': '5a6fc047222cf21ad89f6cbf8782d0f1e3ddacda'}
running build_py
creating build
creating build/lib
creating build/lib/ecdsa
copying ecdsa/__init__.py -> build/lib/ecdsa
copying ecdsa/_version.py -> build/lib/ecdsa
copying ecdsa/curves.py -> build/lib/ecdsa
copying ecdsa/der.py -> build/lib/ecdsa
copying ecdsa/ecdsa.py -> build/lib/ecdsa
copying ecdsa/ellipticcurve.py -> build/lib/ecdsa
copying ecdsa/keys.py -> build/lib/ecdsa
copying ecdsa/numbertheory.py -> build/lib/ecdsa
copying ecdsa/rfc6979.py -> build/lib/ecdsa
copying ecdsa/six.py -> build/lib/ecdsa
copying ecdsa/test_pyecdsa.py -> build/lib/ecdsa
copying ecdsa/util.py -> build/lib/ecdsa
UPDATING build/lib/ecdsa/_version.py
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/__init__.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/curves.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/der.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/ecdsa.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/ellipticcurve.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/keys.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/numbertheory.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/rfc6979.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/six.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/test_pyecdsa.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/util.py -> build/bdist.linux-x86_64/wheel/ecdsa
copying build/lib/ecdsa/_version.py -> build/bdist.linux-x86_64/wheel/ecdsa
running install_egg_info
running egg_info
creating ecdsa.egg-info
writing ecdsa.egg-info/PKG-INFO
writing dependency_links to ecdsa.egg-info/dependency_links.txt
writing top-level names to ecdsa.egg-info/top_level.txt
writing manifest file 'ecdsa.egg-info/SOURCES.txt'
reading manifest file 'ecdsa.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'ecdsa.egg-info/SOURCES.txt'
Copying ecdsa.egg-info to build/bdist.linux-x86_64/wheel/ecdsa-0.13-py3.6.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.linux-x86_64/wheel/ecdsa-0.13.dist-info/WHEEL
creating 'dist/ecdsa-0.13-py2.py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'ecdsa/__init__.py'
adding 'ecdsa/_version.py'
adding 'ecdsa/curves.py'
adding 'ecdsa/der.py'
adding 'ecdsa/ecdsa.py'
adding 'ecdsa/ellipticcurve.py'
adding 'ecdsa/keys.py'
adding 'ecdsa/numbertheory.py'
adding 'ecdsa/rfc6979.py'
adding 'ecdsa/six.py'
adding 'ecdsa/test_pyecdsa.py'
adding 'ecdsa/util.py'
adding 'ecdsa-0.13.dist-info/LICENSE'
adding 'ecdsa-0.13.dist-info/METADATA'
adding 'ecdsa-0.13.dist-info/WHEEL'
adding 'ecdsa-0.13.dist-info/top_level.txt'
adding 'ecdsa-0.13.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
installing
/build/ecdsa-0.13/dist /build/ecdsa-0.13
copying path '/nix/store/ap45zlwknrk2slc5w6rqzw570zxmkdg3-python3.6-pytest-cov-2.6.0' from 'https://cache.nixos.org'...
copying path '/nix/store/9lm42kidqvv571dvpbnvyapqls8awmhd-python3.6-packaging-18.0' from 'https://cache.nixos.org'...
copying path '/nix/store/16lfn103sh7phfgdf0msm6sl7lswhlmd-python3.6-unittest2-1.1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/46yif6qc2adw3lxzm1c61vgjrgcf4sr7-python3.6-cffi-1.11.5-dev' from 'https://cache.nixos.org'...
Processing ./ecdsa-0.13-py2.py3-none-any.whl
Installing collected packages: ecdsa
Successfully installed ecdsa-0.13
/build/ecdsa-0.13
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/6rav801nz8sb39d2mc007kcaj6b9qwaq-python3.6-ecdsa-0.13
strip is /nix/store/jdlb06c0kp6sms277xcclfr3gdl8pb9r-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/6rav801nz8sb39d2mc007kcaj6b9qwaq-python3.6-ecdsa-0.13/lib
patching script interpreter paths in /nix/store/6rav801nz8sb39d2mc007kcaj6b9qwaq-python3.6-ecdsa-0.13
checking for references to /build/ in /nix/store/6rav801nz8sb39d2mc007kcaj6b9qwaq-python3.6-ecdsa-0.13...
copying path '/nix/store/cagl4kffya32mbwyjk3cgi89cny389h9-python3.6-cryptography-2.3.1-dev' from 'https://cache.nixos.org'...
running install tests
running test
building '/nix/store/mcncvdwadrq1335bwy279dg7q0sxhvhp-python3.6-rsa-4.0.drv'...
unpacking sources
unpacking source archive /nix/store/km959nhndbrasamr0zj49w4hswiss72z-rsa-4.0.tar.gz
source root is rsa-4.0
setting SOURCE_DATE_EPOCH to timestamp 1537098221 of file rsa-4.0/setup.cfg
patching sources
configuring
building
Traceback (most recent call last):
  File "nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 20, in <module>
    long_description = f.read()
  File "/nix/store/qbyckcddc74s2fi060n8xqcn8gygrhjl-python3-3.6.8/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 898: ordinal not in range(128)
Testing gcd...
Testing lcm...
Testing next_prime...
Testing square_root_mod_prime for modulus p = 2.
Testing square_root_mod_prime for modulus p = 3.
Testing square_root_mod_prime for modulus p = 5.
Testing square_root_mod_prime for modulus p = 7.
Testing square_root_mod_prime for modulus p = 11.
Testing square_root_mod_prime for modulus p = 13.
Testing square_root_mod_prime for modulus p = 17.
Testing square_root_mod_prime for modulus p = 19.
Testing square_root_mod_prime for modulus p = 23.
Testing square_root_mod_prime for modulus p = 29.
Testing square_root_mod_prime for modulus p = 31.
Testing square_root_mod_prime for modulus p = 37.
Testing square_root_mod_prime for modulus p = 41.
Testing square_root_mod_prime for modulus p = 43.
Testing square_root_mod_prime for modulus p = 47.
Testing square_root_mod_prime for modulus p = 53.
Testing square_root_mod_prime for modulus p = 59.
Testing square_root_mod_prime for modulus p = 61.
Testing square_root_mod_prime for modulus p = 67.
Testing square_root_mod_prime for modulus p = 71.
Testing square_root_mod_prime for modulus p = 73.
Testing square_root_mod_prime for modulus p = 79.
Testing square_root_mod_prime for modulus p = 83.
Testing square_root_mod_prime for modulus p = 89.
Testing square_root_mod_prime for modulus p = 97.
Testing square_root_mod_prime for modulus p = 101.
Testing square_root_mod_prime for modulus p = 103.
Testing square_root_mod_prime for modulus p = 107.
Testing square_root_mod_prime for modulus p = 109.
Testing square_root_mod_prime for modulus p = 113.
Testing square_root_mod_prime for modulus p = 127.
Testing square_root_mod_prime for modulus p = 131.
Testing square_root_mod_prime for modulus p = 137.
Testing square_root_mod_prime for modulus p = 139.
Testing square_root_mod_prime for modulus p = 149.
Testing square_root_mod_prime for modulus p = 151.
Testing square_root_mod_prime for modulus p = 157.
Testing square_root_mod_prime for modulus p = 163.
Testing square_root_mod_prime for modulus p = 167.
Testing square_root_mod_prime for modulus p = 173.
Testing square_root_mod_prime for modulus p = 179.
Testing square_root_mod_prime for modulus p = 181.
Testing square_root_mod_prime for modulus p = 191.
Testing square_root_mod_prime for modulus p = 193.
Testing square_root_mod_prime for modulus p = 197.
Testing square_root_mod_prime for modulus p = 199.
Testing square_root_mod_prime for modulus p = 211.
Testing square_root_mod_prime for modulus p = 223.
Testing square_root_mod_prime for modulus p = 227.
Testing square_root_mod_prime for modulus p = 229.
Testing square_root_mod_prime for modulus p = 233.
Testing square_root_mod_prime for modulus p = 239.
Testing square_root_mod_prime for modulus p = 241.
Testing square_root_mod_prime for modulus p = 251.
Testing square_root_mod_prime for modulus p = 257.
Testing square_root_mod_prime for modulus p = 263.
Testing square_root_mod_prime for modulus p = 269.
Testing square_root_mod_prime for modulus p = 271.
Testing square_root_mod_prime for modulus p = 277.
Testing square_root_mod_prime for modulus p = 281.
Testing square_root_mod_prime for modulus p = 283.
Testing square_root_mod_prime for modulus p = 293.
Testing square_root_mod_prime for modulus p = 307.
Testing square_root_mod_prime for modulus p = 311.
Testing square_root_mod_prime for modulus p = 313.
Testing square_root_mod_prime for modulus p = 317.
Testing square_root_mod_prime for modulus p = 331.
Testing square_root_mod_prime for modulus p = 337.
Testing square_root_mod_prime for modulus p = 347.
Testing square_root_mod_prime for modulus p = 349.
Testing square_root_mod_prime for modulus p = 353.
Testing square_root_mod_prime for modulus p = 359.
Testing square_root_mod_prime for modulus p = 367.
Testing square_root_mod_prime for modulus p = 373.
Testing square_root_mod_prime for modulus p = 379.
Testing square_root_mod_prime for modulus p = 383.
Testing square_root_mod_prime for modulus p = 389.
Testing square_root_mod_prime for modulus p = 397.
Testing square_root_mod_prime for modulus p = 401.
Testing square_root_mod_prime for modulus p = 409.
Testing square_root_mod_prime for modulus p = 419.
Testing square_root_mod_prime for modulus p = 421.
Testing square_root_mod_prime for modulus p = 431.
Testing square_root_mod_prime for modulus p = 433.
Testing square_root_mod_prime for modulus p = 439.
Testing square_root_mod_prime for modulus p = 443.
Testing square_root_mod_prime for modulus p = 449.
Testing square_root_mod_prime for modulus p = 457.
Testing square_root_mod_prime for modulus p = 461.
Testing square_root_mod_prime for modulus p = 463.
Testing square_root_mod_prime for modulus p = 467.
Testing square_root_mod_prime for modulus p = 479.
Testing square_root_mod_prime for modulus p = 487.
Testing square_root_mod_prime for modulus p = 491.
Testing square_root_mod_prime for modulus p = 499.
Testing square_root_mod_prime for modulus p = 503.
Testing square_root_mod_prime for modulus p = 509.
Testing square_root_mod_prime for modulus p = 521.
Testing square_root_mod_prime for modulus p = 523.
Testing square_root_mod_prime for modulus p = 541.
Testing square_root_mod_prime for modulus p = 547.
Testing square_root_mod_prime for modulus p = 557.
Testing square_root_mod_prime for modulus p = 563.
Testing square_root_mod_prime for modulus p = 569.
Testing square_root_mod_prime for modulus p = 571.
Testing square_root_mod_prime for modulus p = 577.
Testing square_root_mod_prime for modulus p = 587.
Testing square_root_mod_prime for modulus p = 593.
Testing square_root_mod_prime for modulus p = 599.
Testing square_root_mod_prime for modulus p = 601.
Testing square_root_mod_prime for modulus p = 607.
Testing square_root_mod_prime for modulus p = 613.
Testing square_root_mod_prime for modulus p = 617.
Testing square_root_mod_prime for modulus p = 619.
Testing square_root_mod_prime for modulus p = 631.
Testing square_root_mod_prime for modulus p = 641.
Testing square_root_mod_prime for modulus p = 643.
Testing square_root_mod_prime for modulus p = 647.
Testing square_root_mod_prime for modulus p = 653.
Testing square_root_mod_prime for modulus p = 659.
Testing square_root_mod_prime for modulus p = 661.
Testing square_root_mod_prime for modulus p = 673.
Testing square_root_mod_prime for modulus p = 677.
Testing square_root_mod_prime for modulus p = 683.
Testing square_root_mod_prime for modulus p = 691.
Testing square_root_mod_prime for modulus p = 701.
Testing square_root_mod_prime for modulus p = 709.
Testing square_root_mod_prime for modulus p = 719.
Testing square_root_mod_prime for modulus p = 727.
Testing square_root_mod_prime for modulus p = 733.
Testing square_root_mod_prime for modulus p = 739.
Testing square_root_mod_prime for modulus p = 743.
Testing square_root_mod_prime for modulus p = 751.
Testing square_root_mod_prime for modulus p = 757.
Testing square_root_mod_prime for modulus p = 761.
Testing square_root_mod_prime for modulus p = 769.
Testing square_root_mod_prime for modulus p = 773.
Testing square_root_mod_prime for modulus p = 787.
Testing square_root_mod_prime for modulus p = 797.
Testing square_root_mod_prime for modulus p = 809.
Testing square_root_mod_prime for modulus p = 811.
Testing square_root_mod_prime for modulus p = 821.
Testing square_root_mod_prime for modulus p = 823.
Testing square_root_mod_prime for modulus p = 827.
Testing square_root_mod_prime for modulus p = 829.
Testing square_root_mod_prime for modulus p = 839.
Testing square_root_mod_prime for modulus p = 853.
Testing square_root_mod_prime for modulus p = 857.
Testing square_root_mod_prime for modulus p = 859.
Testing square_root_mod_prime for modulus p = 863.
Testing square_root_mod_prime for modulus p = 877.
Testing square_root_mod_prime for modulus p = 881.
Testing square_root_mod_prime for modulus p = 883.
Testing square_root_mod_prime for modulus p = 887.
Testing square_root_mod_prime for modulus p = 907.
Testing square_root_mod_prime for modulus p = 911.
Testing square_root_mod_prime for modulus p = 919.
Testing square_root_mod_prime for modulus p = 929.
Testing square_root_mod_prime for modulus p = 937.
Testing square_root_mod_prime for modulus p = 941.
builder for '/nix/store/mcncvdwadrq1335bwy279dg7q0sxhvhp-python3.6-rsa-4.0.drv' failed with exit code 1
cannot build derivation '/nix/store/pifmbmqallj7jkl3ar1wv8nqyfzq08hr-python3.6-python-jose-3.0.1.drv': 1 dependencies couldn't be built
error: build of '/nix/store/pifmbmqallj7jkl3ar1wv8nqyfzq08hr-python3.6-python-jose-3.0.1.drv' failed

[henry@watson:~]$ 

Looking at the Nix trace, it says

builder for '/nix/store/mcncvdwadrq1335bwy279dg7q0sxhvhp-python3.6-rsa-4.0.drv' failed with exit code 1

so it’s actually python36.pkgs.rsa that fails.

The rsa package fails due to a Unicode error. The Nixpkgs manual documents how to solve this specific issue.

Thanks! But is there a way to make glibcLocales a buildInput for all python packages? It happens for a number of packages, and whether it happens or not seems to vary randomly.

It’s indeed often needed with Python 3 packages, but definitely not always. Including it in buildPythonPackage means building a Python 3 package would always require the 122 MB glibcLocales. A better approach is introducing a C.UTF-8 in glibc as many other distro’s have Locales: C.UTF-8 is not available · Issue #20192 · NixOS/nixpkgs · GitHub.

OK, I’m completely stumped. I can’t get a version of python36 to build pandas because of this error. Seemingly little builds. Yet two weeks ago this all worked perfectly. Is there a new, improved way to format python package nix expressions so that they work? Trying to use glibcLocales as a propagatedBuildInput of python36 via overrideAttrs did nothing, and neither did anything else. I must be too much of a noob with Nix to use python with it – I’ve only been using it for 18 months…

The other requirement is to set LC_ALL=en_US.utf-8 environment variable. It needs to be done in every package that exhibits this error, either in the mkDerivation our just for the specific part that requires that (typically tests).

There’d be no harm in just setting that in the standard installCheckPhase, would there?

OK, I know I;'m being really dense, but can anyone put a nix-shell expression that works to install rsa in a python3.6, so I can get an idea what to do. Something like

nix-shell -p 'let py = python36.overrideAttrs(oa: {propagatedBuildInputs=[glibcLocales];}); in py.withPackages([py.rsa])'

but that actually works? If python rsa is uninstallable, along with other packages, is this something that will be fixed, or is it a known persistent state of affairs?

EDIT: One other question: How do I go about setting LC_ALL in my build of python? Or do I need to create a custom version of every single package in the python codebase that does this glibcLocales thing and sets an environment variable? If so, how do I do that? It turns out pandas needs this as well. This is far from a few packages. it seems like it is nearly all of them.

Having to use LC_ALL and requiring glibcLocales is in my opinion a bug. The proper solution is that code is aware of the encoding of the data it reads. Often, because people work in an environment where a locale is configured, Python won’t complain. Convenient, but these assumptions will cause issues for those that don’t have the same assumptions. Having a C.utf-8 is a middle-ground; it often doesn’t make sense anymore not being able to expect having utf-8 around. Including the whole of glibcLocales (which is the current work-around) for that is a bit extreme.

Thanks for all the help! For what it’s worth, I got rsa and a package that depends on it to get past the codec error. The configuration that did it is below, for other people’s amusement. As far as I can tell, there’s no global way to solve this glibcLocales and environment problem globally – one must just add packages, and override for each broken package. If I’m wrong, or if I’m doing something silly in the config below, I’d love to know.

with import <nixpkgs> {};

let
    myPackageOverrides = self: super: {
      rsa = super.rsa.overridePythonAttrs(old: rec {
        LC_ALL = "en_US.UTF-8";
        buildInputs = [ glibcLocales ];
      });
    };
    mypython = pkgs.python36.override {
      packageOverrides = myPackageOverrides;
    };
    mypythonenv = mypython.buildEnv.override {
    ignoreCollisions = true;
    extraLibs = with mypython.pkgs; [
      numpy
      toolz
      rsa
      pandas
    ];
   };
in pkgs.buildEnv {
  name = "eyeserver";
  paths = with pkgs ; [
    mypythonenv
  ];
}
1 Like