Can't install psycopg2 - Can not execute `setup.py`

Viewed 220

I am trying to run the below command on Linux

pip3.9 install psycopg2

but it does not work as I get the following error message:

Collecting psycopg2
  Using cached psycopg2-2.9.3.tar.gz (380 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

I have been looking at a bunch of other SO questions but nothing has worked thus far. e.g. running

pip3.9 install setuptools

returns an already satisfied requirement message.

Any help greatly appreciated.

Thanks

0 Answers
Related