How to Solve Error Message Command “python egg_info” failed with error code 1 in /tmp/pip-build-XPwxXf/charset-normalizer/ when running pip install

Posted on


Actually, the main purpose of this article is to solve an error message appear. It is basically referring to the actual occurrence where the error happened. The error message appear when executing a ‘pip install command’. Upon executing the command for installing necessary module or library specified in the requirements.txt file, the error appear. The following is the actual execution of the command which is triggering the error message to appear :

[django@localhost project]$ pip install -r requirements.txt
Collecting asgiref==3.4.1 (from -r requirements.txt (line 1))
Running (path:/tmp/pip-build-XPwxXf/asgiref/ egg_info for package asgiref produced metadata for project name unknown. Fix your #egg=asgiref fragments.
Requirement already satisfied (use --upgrade to upgrade): unknown from in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Collecting autopep8==1.5.7 (from -r requirements.txt (line 2))
Downloading (45kB)
100% |████████████████████████████████| 51kB 904kB/s
Collecting cachetools==4.2.4 (from -r requirements.txt (line 3))
Running (path:/tmp/pip-build-XPwxXf/cachetools/ egg_info for package cachetools produced metadata for project name unknown. Fix your #egg=cachetools fragments.
Requirement already satisfied (use --upgrade to upgrade): unknown from in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 3))
Collecting certifi==2021.5.30 (from -r requirements.txt (line 4))
Downloading (145kB)
100% |████████████████████████████████| 153kB 4.7MB/s
Collecting charset-normalizer==2.0.7 (from -r requirements.txt (line 5))
Downloading (362kB)
100% |████████████████████████████████| 368kB 2.8MB/s
Complete output from command python egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-XPwxXf/charset-normalizer/", line 44, in <module>
long_description=long_description.replace(':heavy_check_mark:', '✅'),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

Command "python egg_info" failed with error code 1 in /tmp/pip-build-XPwxXf/charset-normalizer/

After facing the error above while thinking about the solution, the following are the attempt for solving the problem :

Try to update the version of the ‘pip’ by executing the following command :

[django@localhost project]$ python3 -m pip install -U pip
Collecting pip
Downloading (1.7MB)
100% |████████████████████████████████| 1.7MB 678kB/s
Installing collected packages: pip
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/", line 215, in main
status =, args)
File "/usr/lib/python3.6/site-packages/pip/commands/", line 365, in run
File "/usr/lib/python3.6/site-packages/pip/req/", line 789, in install
File "/usr/lib/python3.6/site-packages/pip/req/", line 854, in install
File "/usr/lib/python3.6/site-packages/pip/req/", line 1069, in move_wheel_files
File "/usr/lib/python3.6/site-packages/pip/", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3.6/site-packages/pip/", line 287, in clobber
ensure_dir(dest) # common for the 'include' path
File "/usr/lib/python3.6/site-packages/pip/utils/", line 83, in ensure_dir
File "/usr/lib64/python3.6/", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/lib64/python3.6/", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6'

[django@localhost project]$
[django@localhost project]$ exit


As the previous attempt for solving the problem end in failure, there are an article posting about the solution. It exist in the following article in this link. Actually, the attempt in the previous part is a solution to solve it. But instead of using a standard user, use super user or root account as follows :

  1. Doing the same command, but in this time as a ‘root’ or a super user, just execute the command once more :

    [root@localhost django]# python3 -m pip install -U pip
    WARNING: Running pip install with root privileges is generally not a good idea. Try ` install --user` instead.
    Collecting pip
    Downloading (1.7MB)
    100% |████████████████████████████████| 1.7MB 691kB/s
    Installing collected packages: pip
    Successfully installed pip-21.3.1
    [root@localhost django]#
  2. Not only upgrading the ‘pip’ tool, but also the setuptools by executing the same command with a different parameter value as follows :

    [root@localhost django]# python3 -m pip install -U setuptools 
    Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages (39.2.0) 
    Collecting setuptools 
    Downloading setuptools-59.1.1-py3-none-any.whl (951 kB) |████████████████████████████████| 951 kB 1.8 MB/s 
    Installing collected packages: setuptools 
    Attempting uninstall: setuptools 
    Found existing installation: setuptools 39.2.0 
    Uninstalling setuptools-39.2.0: 
    Successfully uninstalled setuptools-39.2.0 
    Successfully installed setuptools-59.1.1 
    WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. 
    It is recommended to use a virtual environment instead: 
    [root@localhost django]#
  3. Finally, just execute the command ‘pip install’ once more as in the introduction part below :
    (env) [django@localhost django]$ pip install -r requirements.txt
    Collecting asgiref==3.4.1
    Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
    Collecting autopep8==1.5.7
    Using cached autopep8-1.5.7-py2.py3-none-any.whl (45 kB)
    Collecting cachetools==4.2.4
    Downloading cachetools-4.2.4-py3-none-any.whl (10 kB)
    Collecting certifi==2021.5.30
    Using cached certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
    Collecting charset-normalizer==2.0.7
    Downloading charset_normalizer-2.0.7-py3-none-any.whl (38 kB)
    Collecting dj-database-url==0.5.0
    Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
    Collecting Django==3.2.6
    Downloading Django-3.2.6-py3-none-any.whl (7.9 MB)
    |████████████████████████████████| 7.9 MB 4.5 MB/s
    Collecting django-ckeditor==6.1.0
    Downloading django_ckeditor-6.1.0-py2.py3-none-any.whl (2.4 MB)
    |████████████████████████████████| 2.4 MB 84.0 MB/s
    Collecting django-js-asset==1.2.2
    Downloading django_js_asset-1.2.2-py2.py3-none-any.whl (5.8 kB)
    Collecting docutils==0.17.1
    Downloading docutils-0.17.1-py2.py3-none-any.whl (575 kB)
    |████████████████████████████████| 575 kB 101.3 MB/s
    Collecting environ==1.0
    Downloading environ-1.0.tar.gz (2.6 kB)
    Preparing metadata ( ... done
    Collecting gunicorn==20.1.0
    Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
    |████████████████████████████████| 79 kB 759 kB/s
    Collecting idna==3.3
    Downloading idna-3.3-py3-none-any.whl (61 kB)
    |████████████████████████████████| 61 kB 1.2 MB/s
    Collecting Pillow==8.3.2
    Downloading Pillow-8.3.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
    |████████████████████████████████| 3.0 MB 74.9 MB/s
    Collecting protobuf==3.19.0
    Downloading protobuf-3.19.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
    |████████████████████████████████| 1.1 MB 71.8 MB/s
    Collecting pyasn1==0.4.8
    Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
    |████████████████████████████████| 77 kB 1.0 MB/s
    Collecting pyasn1-modules==0.2.8
    Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
    |████████████████████████████████| 155 kB 89.5 MB/s
    Collecting pycodestyle==2.7.0
    Downloading pycodestyle-2.7.0-py2.py3-none-any.whl (41 kB)
    |████████████████████████████████| 41 kB 72 kB/s
    Collecting python-decouple==3.4
    Downloading python_decouple-3.4-py3-none-any.whl (9.5 kB)
    Collecting pytz==2021.1
    Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)
    |████████████████████████████████| 510 kB 97.2 MB/s
    Collecting requests==2.26.0
    Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB)
    |████████████████████████████████| 62 kB 154 kB/s
    Collecting rsa==4.7.2
    Downloading rsa-4.7.2-py3-none-any.whl (34 kB)
    Collecting six==1.16.0
    Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
    Collecting sqlparse==0.4.2
    Downloading sqlparse-0.4.2-py3-none-any.whl (42 kB)
    |████████████████████████████████| 42 kB 133 kB/s
    Collecting toml==0.10.2
    Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
    Collecting Unipath==1.1
    Downloading Unipath-1.1.tar.gz (30 kB)
    Preparing metadata ( ... done
    Collecting urllib3==1.26.7
    Downloading urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
    |████████████████████████████████| 138 kB 94.1 MB/s
    Collecting whitenoise==5.3.0
    Downloading whitenoise-5.3.0-py2.py3-none-any.whl (19 kB)
    Collecting wincertstore==0.2
    Downloading wincertstore-0.2-py2.py3-none-any.whl (8.8 kB)
    Collecting typing-extensions
    Using cached typing_extensions-4.0.0-py3-none-any.whl (22 kB)
    Requirement already satisfied: setuptools>=3.0 in /home/django/env/lib/python3.6/site-packages (from gunicorn==20.1.0->-r requirements.txt (line 12)) (58.3.0)
    Building wheels for collected packages: environ, Unipath
    Building wheel for environ ( ... done
    Created wheel for environ: filename=environ-1.0-py3-none-any.whl size=3247 sha256=aacab5a660718aadde2d6b0e547b097b51e8419ef2cca426490c01ac21f175a8
    Stored in directory: /home/django/.cache/pip/wheels/fb/65/b4/382c767bd57e41b3ab4a63b947eeadbe45caf2b2fa1803024b
    Building wheel for Unipath ( ... done
    Created wheel for Unipath: filename=Unipath-1.1-py3-none-any.whl size=9125 sha256=77e27802bc7f9cf220a81a369682ba7d56c38ce99418d047892b7ab85018d379
    Stored in directory: /home/django/.cache/pip/wheels/f4/87/b1/64ab49f2cc29e391daf42823b9f76c858fd9bcb43a28f3e8c8
    Successfully built environ Unipath
    Installing collected packages: typing-extensions, urllib3, toml, sqlparse, pytz, pycodestyle, pyasn1, idna, django-js-asset, charset-normalizer, certifi, asgiref, wincertstore, whitenoise, Unipath, six, rsa, requests, python-decouple, pyasn1-modules, protobuf, Pillow, gunicorn, environ, docutils, django-ckeditor, Django, dj-database-url, cachetools, autopep8
    Successfully installed Django-3.2.6 Pillow-8.3.2 Unipath-1.1 asgiref-3.4.1 autopep8-1.5.7 cachetools-4.2.4 certifi-2021.5.30 charset-normalizer-2.0.7 dj-database-url-0.5.0 django-ckeditor-6.1.0 django-js-asset-1.2.2 docutils-0.17.1 environ-1.0 gunicorn-20.1.0 idna-3.3 protobuf-3.19.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycodestyle-2.7.0 python-decouple-3.4 pytz-2021.1 requests-2.26.0 rsa-4.7.2 six-1.16.0 sqlparse-0.4.2 toml-0.10.2 typing-extensions-4.0.0 urllib3-1.26.7 whitenoise-5.3.0 wincertstore-0.2
    (env) [django@localhost django]$

Leave a Reply