0

I have installed Postgresql@14 on my system using homebrew. I want to install pl/python on my database but on running the command CREATE EXTENSION plpython3u;

ERROR:  could not open extension control file "/opt/homebrew/share/postgresql@14/extension/plpython3u.control": No such file or directory

As the files for PL/Python are not pre-installed in this homebrew version. I tried to install from source.

but on running make and make install command, getting the same error for both:

Makefile:5: ../../../src/Makefile.global: No such file or directory
Makefile:103: /src/Makefile.shlib: No such file or directory
make: *** No rule to make target `/src/Makefile.shlib'.  Stop.

How can i install Pl/Python on my Homebrew Postgresql@14?

Ishaan Adarsh
  • 197
  • 1
  • 11
  • 1) As explained [here](https://stackoverflow.com/questions/76738792/issue-in-installing-pl-python-on-postgres) `plpython` is part of the core code and needs to be built with it not as a stand alone package. 2) The Homebrew [formula](https://github.com/Homebrew/homebrew-core/blob/1d33d1809b2ecc26705232b6b109b0471ba13186/Formula/postgresql@14.rb) does not have `--with-python` so it will not build it. 3) If you are not too invested in Homebrew you could switch to [Postgres.app](https://postgresapp.com/). – Adrian Klaver Jul 25 '23 at 15:54
  • I can switch, but there must be a way to install pl/python on homebrew. just looking for that – Ishaan Adarsh Jul 25 '23 at 15:56
  • Add `--with-python` to the formula and retry the install? Though I'm pretty sure that is going to require having the Python dev libraries installed. – Adrian Klaver Jul 25 '23 at 16:02
  • Did'nt work by adding `--with-python` – Ishaan Adarsh Jul 26 '23 at 07:05
  • Define *didn't work* in more detail. – Adrian Klaver Jul 26 '23 at 15:05
  • @AdrianKlaver, the error is on running `brew install postgresql@11 --with-python`. Its giving the error: `Error: invalid option: --with-python`. I dont think this works in homebrew. – Ishaan Adarsh Jul 27 '23 at 12:15

1 Answers1

1

The steps to install PL/Python on Homebrew - installed PostgreSQL are as follows:

a. Install Xcode CLI

b. Make sure there is python installed on the system and go to PostgreSQL downloads page and install that.

c. Extract source code from the file that you have downloaded.

d. Configure the build and install PostgreSQL.

e. Now build and install PL/Python.

Following these steps should help you with the installation of PostgreSQL

  • Could you be more detailed about the extraction of the source code? That is where i am facing an issue. Running the `make` and `make install` errors are given above. – Ishaan Adarsh Jul 27 '23 at 12:11