Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment

I tried to deploy my flask application in a docker in ubuntu18.04, and I was using python3.5 in my pipenv. But when I run docker build -t flask ., at a step of RUN pipenv install,I got this error:

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8

But when I checked my locale with locale,it returned

LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=C.UTF-8

I guessed maybe something was different in docker so I tried to add

RUN export LC_ALL=C.UTF-8
RUN export LANG=C.UTF-8

into my Dockerfile, but still got this error.

I'm shriveled. Since I had set all to C.utf-8, I have no idea why it's still complaining. I had searched this problem online but unfortunately all the methods seemed to be useless in my case :( Maybe there are some tiny things I have been ignoring, but I really cannot figure them out. I hope someone could help me out and save me another 3 hours.Thanks.

like image 634
bohnsix Avatar asked Aug 26 '19 06:08

bohnsix


1 Answers

RUN will just run command in layer while building it. set this env variable ENV export LC_ALL=C.UTF-8 ENV export LANG=C.UTF-8

like image 55
Aftab Avatar answered Nov 20 '22 00:11

Aftab