Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] error: metadata-generation-failed #2033

Open
2 tasks done
JiBingdong opened this issue Apr 10, 2024 · 1 comment
Open
2 tasks done

[Bug] error: metadata-generation-failed #2033

JiBingdong opened this issue Apr 10, 2024 · 1 comment
Assignees

Comments

@JiBingdong
Copy link

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmocr

Environment

我在今天下载了最新版本的mmocr,但是按照安装教程执行pip install -v -e .出现错误

Reproduces the problem - code sample

(open-mmlab) ji@Y7000P:~/mmocr$ pip install -v -e .

Reproduces the problem - command or script

git clone https://github.com/open-mmlab/mmocr.git
cd mmocr
pip install -v -e .

"-v" increases pip's verbosity.

"-e" means installing the project in editable mode,

That is, any local modifications on the code will take effect immediately.

Reproduces the problem - error message

Using pip 23.3.1 from /home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/pip (python 3.8)
Obtaining file:///home/ji/mmocr
Running command python setup.py egg_info
/home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/setuptools/dist.py:804: SetuptoolsDeprecationWarning: Deprecated API usage.
!!

      ********************************************************************************
      As setuptools moves its configuration towards `pyproject.toml`,
      `setuptools.config.parse_configuration` became deprecated.

      For the time being, you can use the `setuptools.config.setupcfg` module
      to access a backward compatible API, but this module is provisional
      and might be removed in the future.

      To read project metadata, consider using
      ``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
      For simple scenarios, you can also try parsing the file directly
      with the help of ``configparser``.
      ********************************************************************************

!!
parse_configuration(
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/home/ji/mmocr/setup.py", line 170, in
setup(
File "/home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/setuptools/init.py", line 154, in setup
_install_setup_requires(attrs)
File "/home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/setuptools/init.py", line 146, in _install_setup_requires
dist.parse_config_files(ignore_option_errors=True)
File "/home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/setuptools/dist.py", line 804, in parse_config_files
parse_configuration(
File "/home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/setuptools/config/init.py", line 36, in _wrapper
return fn(*args, **kwargs)
File "/home/ji/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/setuptools/config/setupcfg.py", line 190, in parse_configuration
distribution._referenced_files.update(
AttributeError: 'MinimalDistribution' object has no attribute '_referenced_files'
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /home/ji/anaconda3/envs/open-mmlab/bin/python -c '
exec(compile('"'"''"'"''"'"'

This is -- a caller that pip uses to run setup.py

- It imports setuptools before invoking setup.py, to enable projects that directly

import from distutils.core to work with newer packaging standards.

- It provides a clear error message when setuptools is not installed.

- It sets sys.argv[0] to the underlying setup.py, when invoking setup.py so

setuptools doesn'"'"'t think the script is -c. This avoids the following warning:

manifest_maker: standard file '"'"'-c'"'"' not found".

- It generates a shim setup.py, for handling setup.cfg-only projects.

import os, sys, tokenize

try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)

file = %r
sys.argv[0] = file

if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = ""
setup_py_code = "from setuptools import setup; setup()"

exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'/home/ji/mmocr/setup.py'"'"',), "", "exec"))' egg_info --egg-base /tmp/pip-pip-egg-info-97yqjog5
cwd: /home/ji/mmocr/
Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Additional information

No response

@theseafaringturtle
Copy link

I ran into the same problem, solved it by running pip install setuptools --upgrade (version 69.5.1), since the bug seems fixed in the latest version. I only get a warning about openxlab now.

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

No branches or pull requests

3 participants