coddingtonbear / django-measurement

Easily store, retrieve, and convert measurements of weight, volume, distance, area and more.
MIT License
145 stars 33 forks source link

Installation of 3.2.4 fails because of incorrect usage of setuptools (error: metadata-generation-failed) #114

Open striveforbest opened 1 year ago

striveforbest commented 1 year ago

Python version 3.8.15 Pipenv version 2022.12.19 (pip version 22.3.1) Setuptools version 65.6.3

Traceback:

$ pipenv install --clear --keep-outdated --selective-upgrade django-measurement -vvv
Loading .env environment variables...
Installing django-measurement...
Writing supplied requirement line to temporary file: 'django-measurement'
Installing 'django-measurement'
$ /Users/alex.zagoro/venv/noya-4UEHQ2KQ/bin/python /usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/__pip-runner__.py install --no-input --verbose --upgrade --upgrade-strategy=only-if-needed --exists-action=w -r /var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pipenv-np4m7i5o-requirements/pipenv-y7em9u0m-requirement.txt -i https://pypi.org/simple
Using source directory: '/Users/alex.zagoro/venv/noya-4UEHQ2KQ/src'
⠴ Installing package: django-measurement[31m[1mError: [0m An error occurred while installing [32mdjango-measurement[0m!
Error text: Using pip 22.3.1 from
/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip (python
3.8)
Collecting django-measurement
  Using cached django_measurement-3.2.4-py2.py3-none-any.whl (7.2 kB)
Requirement already satisfied: django-appconf>=1.0.2 in
/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages (from django-measurement->-r
/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pipenv-np4m7i5o-requirements/pipenv-y7em9u0m-require
ment.txt (line 1)) (1.0.4)
Requirement already satisfied: django>=2.2 in
/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages (from django-measurement->-r
/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pipenv-np4m7i5o-requirements/pipenv-y7em9u0m-require
ment.txt (line 1)) (3.2.8)
Collecting measurement<4.0,>=1.6
  Using cached measurement-3.2.0.tar.gz (12 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

[36m  Running command python setup.py egg_info
  /Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508
: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
    warnings.warn(msg, warning_class)
  /Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages/setuptools/installer.py:27:
SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by
a PEP 517 installer.
    warnings.warn(
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File
"/private/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pip-install-0ik4ruc1/measurement_ceca7db089
394f61b736dfea8cfd7884/setup.py", line 4, in <module>
      setup(use_scm_version=True)
    File "/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages/setuptools/__init__.py",
line 86, in setup
      _install_setup_requires(attrs)
    File "/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages/setuptools/__init__.py",
line 80, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages/setuptools/dist.py", line
874, in fetch_build_eggs
      resolved_dists = pkg_resources.working_set.resolve(
    File
"/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages/pkg_resources/__init__.py", line
800, in resolve
      raise VersionConflict(dist, req).with_context(dependent_req)
  pkg_resources.ContextualVersionConflict: (sphinxcontrib.applehelp 1.0.3
(/private/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pip-install-0ik4ruc1/measurement_ceca7db089
394f61b736dfea8cfd7884/.eggs/sphinxcontrib.applehelp-1.0.3-py3.8.egg),
Requirement.parse('sphinxcontrib-applehelp'), {'sphinx'})
  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: /Users/alex.zagoro/venv/noya-4UEHQ2KQ/bin/python -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- 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 = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' %
('"'"'/private/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pip-install-0ik4ruc1/measurement_ceca7
db089394f61b736dfea8cfd7884/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base
/private/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pip-pip-egg-info-yrq15d5v
  cwd:
/private/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pip-install-0ik4ruc1/measurement_ceca7db0893
94f61b736dfea8cfd7884/
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.
[0m
[36mUsing pip 22.3.1 from
/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip (python
3.8)
Collecting django-measurement
  Using cached django_measurement-3.2.4-py2.py3-none-any.whl (7.2 kB)
Requirement already satisfied: django-appconf>=1.0.2 in
/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages (from django-measurement->-r
/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pipenv-np4m7i5o-requirements/pipenv-y7em9u0m-require
ment.txt (line 1)) (1.0.4)
Requirement already satisfied: django>=2.2 in
/Users/alex.zagoro/venv/noya-4UEHQ2KQ/lib/python3.8/site-packages (from django-measurement->-r
/var/folders/01/c2gzvfh566b07_yvphkhv7fw0000gn/T/pipenv-np4m7i5o-requirements/pipenv-y7em9u0m-require
ment.txt (line 1)) (3.2.8)
Collecting measurement<4.0,>=1.6
  Using cached measurement-3.2.0.tar.gz (12 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
[0m
This is likely caused by a bug in [32mdjango-measurement[0m. Report this to its maintainers.
✘ Installation Failed
striveforbest commented 1 year ago

The fix for python-measurement was submitted and also backported to python-measurement==3.2.2 however I recommend getting django-measurement updated to work with the latest python-measurement

https://github.com/coddingtonbear/python-measurement/pull/76