OCA / maintainer-tools

Odoo Maintainers Tools & conventions for OCA members which evaluate and maintain repositories.
GNU Affero General Public License v3.0
271 stars 454 forks source link

Fail to run pre-commit on OCA project: ERROR No matching distribution found for setuptools_scm #597

Closed mostafabarmshory closed 9 months ago

mostafabarmshory commented 9 months ago

I clone an OCA project (IoT) and run the following command:

pre-commit run -a

It fails with the following error. I google and try many ways but they wont fix

[INFO] Initializing environment for https://github.com/oca/maintainer-tools.
[INFO] Initializing environment for https://github.com/OCA/odoo-pre-commit-hooks.
[INFO] Initializing environment for https://github.com/myint/autoflake.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:@prettier/plugin-xml@2.2.0,prettier@2.7.1.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint:eslint@8.24.0.
[INFO] Initializing environment for https://github.com/asottile/pyupgrade.
[INFO] Initializing environment for https://github.com/PyCQA/flake8.
[INFO] Initializing environment for https://github.com/PyCQA/flake8:flake8-bugbear==21.9.2.
[INFO] Initializing environment for https://github.com/OCA/pylint-odoo.
[INFO] Installing environment for https://github.com/oca/maintainer-tools.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/bin/python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout:
    Looking in indexes: http://192.168.88.100:5000/index/
    Processing /home/maso/.cache/pre-commit/repohny2buv2
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'error'

stderr:
      error: subprocess-exited-with-error

      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [48 lines of output]
          /home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
          !!

                  ********************************************************************************
                  Requirements should be satisfied by a PEP 517 installer.
                  If you are using pip, you can try `pip install --use-pep517`.
                  ********************************************************************************

          !!
            dist.fetch_build_eggs(dist.setup_requires)
          WARNING: The repository located at 192.168.88.100 is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host 192.168.88.100'.
          ERROR: Could not find a version that satisfies the requirement setuptools_scm (from versions: none)
          ERROR: No matching distribution found for setuptools_scm
          Traceback (most recent call last):
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/installer.py", line 96, in _fetch_build_egg_no_warn
              subprocess.check_call(cmd)
            File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
              raise CalledProcessError(retcode, cmd)
          subprocess.CalledProcessError: Command '['/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp5a_cd42i', '--quiet', 'setuptools_scm']' returned non-zero exit status 1.

          The above exception was the direct cause of the following exception:

          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/home/maso/.cache/pre-commit/repohny2buv2/setup.py", line 11, in <module>
              setuptools.setup(
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/__init__.py", line 106, in setup
              _install_setup_requires(attrs)
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/__init__.py", line 79, in _install_setup_requires
              _fetch_build_eggs(dist)
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/__init__.py", line 84, in _fetch_build_eggs
              dist.fetch_build_eggs(dist.setup_requires)
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
              return _fetch_build_eggs(self, requires)
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
              resolved_dists = pkg_resources.working_set.resolve(
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/pkg_resources/__init__.py", line 827, in resolve
              dist = self._resolve_dist(
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
              dist = best[req.key] = env.best_match(
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1133, in best_match
              return self.obtain(req, installer)
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1145, in obtain
              return installer(requirement)
            File "/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/lib/python3.10/site-packages/setuptools/installer.py", line 98, in _fetch_build_egg_no_warn
              raise DistutilsError(str(e)) from e
          distutils.errors.DistutilsError: Command '['/home/maso/.cache/pre-commit/repohny2buv2/py_env-python3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp5a_cd42i', '--quiet', 'setuptools_scm']' returned non-zero exit status 1.
          [end of output]

      note: This error originates from a subprocess, and is likely not a problem with pip.
    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.

Check the log at /home/maso/.cache/pre-commit/pre-commit.log
sbidoul commented 9 months ago

You'll need to investigate why pip is looking a at http://192.168.88.100:5000/.

Probably some global config you have set on your machine.

mostafabarmshory commented 9 months ago

@sbidoul tx bor.

That is my PIP proxy cache. I removed that and my problem is fixed. I could understand why.

However tx for your help.