Pip installation error: "python setup.py egg_info" failed with error code 1

Asked 2 years ago, Updated 2 years ago, 151 views

$pip install-r.examples/requirements.txt

When I ran

Command "python setup.py eg_info" failed with error code 1 in /tmp/pipe-build-VIFN4h/sacrebleu/

The error occurred.
Also, until now,

$pip install-upgrade setupools

I tried but it didn't work.

How do I resolve this error?


After reading the article you mentioned, I realized that I had not upgraded pip setup tools, so I executed the following command:

$pip install-upgrade pip

The error changed to the following:

ERROR: Command errored out with exit status1:
 command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jEHSxk/sacrebleu/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jEHSxk/sacrebleu/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base/tmp/pipe-install-jEHSxk/sacrebleu/pipe-egg-info
     cwd: /tmp/pipe-install-jEHSxk/sacrebleu/
Complete output (7 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File"/tmp/pipe-install-jEHSxk/sacrebleu/setup.py", line 65, in <module>
    version=get_version(),
  File"/tmp/pipe-install-jEHSxk/sacrebleu/setup.py", line56, inget_version
    with open(os.path.join(os.path.dirname(__file__), 'sacrebleu.py', encoding='utf-8') asfin:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
ERROR: Command error out with exit status 1: python setup.py eg_info Check the logs for full command output.

python pip setuptools

2022-09-30 19:43

1 Answers

I will answer it as a record as it seems to have been resolved in the comments.

The main reason is that I was trying to install a package sacrebleu that only supports Python 3.x series.
It was resolved by setting the installation environment to Python 3.x (using pip3).

At first, the Python 2.x pip, setuptools were not up to date, so things changed step by step.

Below is the details of the circumstances.

Search python setup.py egg_info error code1 to find the following:
Installation error on pipe: Command "python setup.py eg_info" failed
[Python] Workaround for "Command" python setup.py eg_info" failed with error code 1 in..."
"python setup.py egg_info" failed..." error during pip install

The first StackOverflow article was old, and the second half had good things written on it.

In the beginning when you're not familiar with errors, you may start looking at only the bottom error message and searching on Google.I can't understand why if I look at it at a glance.
But surprisingly, it's simple and firm, and if it's a polite library, it even says, "Where did the error occur?"

Also, since sacrebleu at the end of the error message seems to be the package name, there was a recent issue in the Issue column of GitHub that I searched for.
v1.4.6 break some imports#71

Actually, setuptools was updated, but pip (which was incorrectly written as setuptools) was not yet, so the update changed the situation, so the error message was added.

File"/tmp/pipe-install-jEHSxk/sacrebleu/setup.py", line56, inget_version
    with open(os.path.join(os.path.dirname(__file__), 'sacrebleu.py', encoding='utf-8') asfin:
TypeError: 'encoding' is an invalid keyword argument for this function

The invalid keyword in the last open() of open() seems to be Python 2.x series, and when I looked at the PyPI information, it said 3.x series only, which is probably the cause.
sacrebleu·PyPIProgramming Language is Python::3::Only

During installation, I was asked how to specify Python 3 series, so I asked if I could use pip3 to solve the problem.


2022-09-30 19:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.