pythoninstallationpippackageanaconda

Getting error “error: subprocess-exited-with-error” while installing using "pip install --cert"


I have tried to install using anaconda prompt,

pip --cert "D:\DDownloads\MyCert.pem" install tflite_support

And ended up with error,

  Collecting tflite_support
  Using cached tflite-support-0.1.0a1.tar.gz (390 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      D:\AI\Anaconda\Lib\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: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      ERROR: Could not find a version that satisfies the requirement pybind11>=2.4 (from versions: none)
      ERROR: No matching distribution found for pybind11>=2.4
      Traceback (most recent call last):
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\installer.py", line 96, in _fetch_build_egg_no_warn
          subprocess.check_call(cmd)
        File "D:\AI\Anaconda\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['D:\\AI\\Anaconda\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\user.sk\\AppData\\Local\\Temp\\tmpfjgjp7hu', '--quiet', 'pybind11>=2.4']' 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 "C:\Users\user.sk\AppData\Local\Temp\pip-install-ok_9cx2o\tflite-support_76f7e4f7f27f407ba020192d982c23a5\setup.py", line 143, in <module>
          setup(
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\dist.py", line 907, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 829, in resolve
          dist = self._resolve_dist(
                 ^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 865, in _resolve_dist
          dist = best[req.key] = env.best_match(
                                 ^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 1135, in best_match
          return self.obtain(req, installer)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 1147, in obtain
          return installer(requirement)
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\installer.py", line 98, in _fetch_build_egg_no_warn
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['D:\\AI\\Anaconda\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\user.sk\\AppData\\Local\\Temp\\tmpfjgjp7hu', '--quiet', 'pybind11>=2.4']' 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.

How to resolve this issue?

Note that I have valid certificate that has been used successfully before.


Solution

  • The issue is during dependency installation. Setuptools seems to run the command

    '['D:\\AI\\Anaconda\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\user.sk\\AppData\\Local\\Temp\\tmpfjgjp7hu', '--quiet', 'pybind11>=2.4']'
    

    to install pybind11>=2.4 from the requirements of tflite-support-0.1.0a1. As you can see, the --cert that you set in the original pip install command is not set anymore. I would call this a bug, but am not to deep in the specific inner workings of pip/setuptools here to say who is at fault.

    I can think of two possible workarounds:

    1. You could just install the dependencies manually, e.g. do pip install --cert pybind11>=2.4 "D:\DDownloads\MyCert.pem"
    2. Set the certificate in pip options, either by editing your pip.conf file, or running python -m pip config set global.cert D:\DDownloads\MyCert.pem