NotAName
NotAName

Reputation: 4347

setup.py - metadata-generation-failed

So after a couple weeks of coding in my free time I decided to publish my first package to PYPI.

I followed this good guide I found on Medium on how to publish to PYPI and to create setup.py I followed the example script linked on the official documentation, but now I'm trying to test the package in a brand new venv and I'm having trouble installing it. The install script gives the following error:

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-n98_mli9/gisterical_9bbb85fbb9174141b0879737b7b585c1/setup.py", line 7, in <module>
          long_description = (here / "readme.md").read_text(encoding="utf-8")
        File "/usr/lib64/python3.10/pathlib.py", line 1134, in read_text
          with self.open(mode='r', encoding=encoding, errors=errors) as f:
        File "/usr/lib64/python3.10/pathlib.py", line 1119, in open
          return self._accessor.open(self, mode, buffering, encoding, errors,
      FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-n98_mli9/gisterical_9bbb85fbb9174141b0879737b7b585c1/readme.md'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

I'm not entirely sure where I went wrong. Here is my setup.py

from setuptools import setup, find_packages
import pathlib

here = pathlib.Path(__file__).parent.resolve()

long_description = (here / "readme.md").read_text(encoding="utf-8")

setup(
    name='GISterical',
    version='0.5.3',
    license='MIT',
    author="<my name>",
    author_email='<my email>',
    packages=find_packages('src'),
    package_dir={'': 'src'},
    url='https://github.com/pavelcherepan/gisterical',
    long_description=long_description,
    long_description_content_type="text/markdown",
    keywords='example project',
        classifiers=[
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3 :: Only",
    ],
    python_requires=">=3.9, <4",
    install_requires=[
          'loguru', 
          'SQLAlchemy>=1.4', 
          'GeoAlchemy2>=0.12',
          'exif',
          'attrs',
          'ImageHash',
          'Pillow',
          'psycopg2-binary>=2.8'
      ],
    entry_points={
        "console_scripts": [
            "gisterical=gisterical:gisterical",
        ],
    },
)

And my setup.cfg


[metadata]
description-file=readme.md
license_files=LICENSE.rst

I don't really understand what the problem is with readme.md because it displays correctly on PYPI project page.

Upvotes: 1

Views: 2109

Answers (1)

phd
phd

Reputation: 94502

You've forgotten to add readme.md as a data file. Please note that only README* files are automatically included. Rename your readme.md file to README.md or add it as a data file using MANIFEST.in.

Upvotes: 1

Related Questions