Home > database >  Trying to deploy API on Heroku issue Preparing metadata (pyproject.toml) did not run successfully
Trying to deploy API on Heroku issue Preparing metadata (pyproject.toml) did not run successfully

Time:07-14

I'm using Python 3.9.2. to develop a Flask API and my code runs fine and I'm able to run the API locally and return the expected data but I want to deploy it to for more testing.

I've tried downgrading my version of Numpy in requirements.txt but still getting same error.

Preparing metadata (pyproject.toml): finished with status 'error'
         error: subprocess-exited-with-error
         
         × Preparing metadata (pyproject.toml) did not run successfully.
         │ exit code: 1
         ╰─> [123 lines of output]
             setup.py:461: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-anq37ukt'), proceeding with generating Cython sources and expanding templates
               warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
             setup.py:563: DeprecationWarning:
             
               `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
               of the deprecation of `distutils` itself. It will be removed for
               Python >= 3.12. For older Python versions it will remain present.
               It is recommended to use `setuptools < 60.0` for those Python versions.
               For more details, see:
                 https://numpy.org/devdocs/reference/distutils_status_migration.html
             

CodePudding user response:

in your requirements.txt try to set a lower version of setuptools and numpy as reported by the error message

requirements.txt:

...
setuptools==59.8.0
numpy==1.19.2
...

CodePudding user response:

The issue was with the Python version that Heroku was using to build the app. I created a runtime.txt file and specified Python 3.9.12 which fixed the issue.

  • Related