Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

FileNotFoundError: [Errno 2] No such file or directory: 'locale' #110

Closed
exarkun opened this issue Mar 1, 2017 · 5 comments
Closed

FileNotFoundError: [Errno 2] No such file or directory: 'locale' #110

exarkun opened this issue Mar 1, 2017 · 5 comments
Milestone

Comments

@exarkun
Copy link

exarkun commented Mar 1, 2017

bash-4.3# pypi2nix -V "2.7" -e treq
Traceback (most recent call last):
  File "/nix/store/yaks2zlw5sj7l92srmji0gnl3bfc9jl8-pypi2nix-1.8.0/bin/.pypi2nix-wrapped", line 3, in <module>
    pypi2nix.cli.main()
  File "/nix/store/yaks2zlw5sj7l92srmji0gnl3bfc9jl8-pypi2nix-1.8.0/pkgs/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/yaks2zlw5sj7l92srmji0gnl3bfc9jl8-pypi2nix-1.8.0/pkgs/click/core.py", line 676, in main
    _verify_python3_env()
  File "/nix/store/yaks2zlw5sj7l92srmji0gnl3bfc9jl8-pypi2nix-1.8.0/pkgs/click/_unicodefun.py", line 64, in _verify_python3_env
    stderr=subprocess.PIPE).communicate()[0]
  File "/nix/store/06af6d830iawfqbla1vjzckpzmyqswvi-python3-3.5.2/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/nix/store/06af6d830iawfqbla1vjzckpzmyqswvi-python3-3.5.2/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'locale'
@garbas
Copy link
Contributor

garbas commented Mar 1, 2017

@exarkun I have good news and bad news.

  1. GOOD: the following command was able to generate Nix expressions
%  pypi2nix -V "2.7" -e treq -E "libffi openssl" -v

Keep in mind that I was using pypi2nix from current master.

  1. BAD: generated nix expressions include many circular dependencies which are quite common with Twisted and zope like packages. This can be usually solved with requirements_override.nix but I'm lacking the knowledge to make a judgment how to fix it.

There is a plan to fix circular dependencies this year, but major refactoring, how Nix wraps python packages, is needed.

Thank you for reporting this problem. Once I (or anybody else) tackles this problem we need many examples to prove that solution works.

@Perlence
Copy link

Perlence commented Mar 30, 2017

I don't see how libffi and openssl relate to missing "locale".

The problem comes from click package, as it tries to ensure that locales are set to UTF-8 by running locale command, which is missing.

EDIT: I initially encountered the same problem when I installed pypi2nix in a Docker container (https://github.com/LnL7/nix-docker) and tried to run it there.

@seppeljordan
Copy link
Contributor

seppeljordan commented Mar 31, 2017

I was running into a similar problem when I wanted to deploy a click based application with numtide/nix-builder. To solve this issue I also installed <nixpkgs>.glibc and <nixpkgs>.glibcLocales. Then, when starting the container, I do something like this:

docker run \
    -e 'LC_ALL=en_US.UTF-8' \
    -e 'LANG=en_US.UTF-8' \
    -e 'LOCALE_ARCHIVE=/root/.nix-profile/lib/locale/locale-archive' \
    myapp:latest start-my-app.sh

When you build your docker image with the nix function buildDockerImage, then you would probably point LOCAL_ARCHIVE to /lib/locale/local-archive. I hope that helps.

@Perlence
Copy link

@seppeljordan Thank you very much!

@garbas
Copy link
Contributor

garbas commented Apr 10, 2017

i think this issue was solved. please reopen if i'm wrong

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants