-2

Using Python 3.10.6 on new Ubuntu VPS. Can't pip install dotenv, bs4 etc.

pip 22.3.1 version used.

Why is this error showing, how do I fix this? I looked at other questions, but couldn't solve my problem. I tried having a lower pip version, didn't work. I even reinstalled python3.10.

Thanks. (below error log - some emitted, all related)

root@localhost:~/bp-scraper# pip3 install dotenv
Collecting dotenv
  Using cached dotenv-0.0.5.tar.gz (2.4 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [64 lines of output]
      /usr/local/lib/python3.10/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
        error: subprocess-exited-with-error

        × python setup.py egg_info did not run successfully.
        │ exit code: 1
        ╰─> [16 lines of output]
            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 14, in <module>
                from setuptools.command.install import install
              File "/tmp/pip-wheel-pm4y5c7z/distribute_07cb0f8f57c049ab919d5b5646e56f
                register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
            AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
            [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.
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/dist-packages/setuptools/installer.py", line 82, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpwdcseb1p', '--quiet', 'distribute']' 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>
          return fetch_build_egg(self, req)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/installer.py", line 84, in fetch_build_egg
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpwdcseb1p', '--quiet', 'distribute']' 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.
Kevin A.
  • 99
  • 2
  • 2
  • 10

1 Answers1

1

First update setuptools, as per https://stackoverflow.com/a/58754136/5666087

pip install -U setuptools

Then use the correct package for dotenv, which is python-dotenv.

pip install python-dotenv
jkr
  • 17,119
  • 2
  • 42
  • 68