DEV Community

Chidera Stella Onumajuru
Chidera Stella Onumajuru

Posted on • Updated on

Step-by-step guide on installing pgAmin from source code on windows and configuring it for development.

Introduction.

pgAdmin is a management tool for PostgreSQL and EDB Postgres advanced server, in this blog post, You will install it from source code in your Windows machine. According to the official GitHub repo,

pgAdmin 4 is written as a web application in Python, using jQuery and Bootstrap for the client side processing and UI. On the server side, Flask is being utilised.

Pre-requisites.

You need to install the tools below.

Installation Guide.

  1. Create a directory in any terminal of choice, I will be using gitbash for this tutorial.

    mkdir pgadmin && cd pgadmin
    
  2. Clone the repository from GitHub by running the command below.

    git clone https://github.com/pgadmin-org/pgadmin4.git
    
    

    This will successfully install it.

Building the Runtime for the frontend.

  1. To build the runtime for the frontend, enter into the directory /pgadmin4/runtime, create a new file called dev_config.json copy the contents of the file dev_config.json.in into this file. Inside the dev_config.jsonfile, edit the python path to the actual path to the python.exe in your machine.

  2. Run the command yarn install.

  3. Execute the runtime by running this command.

    node_modules/nw/nwjs/nw
    

    This will start the pgAdmin.

Configuring the Python Environment for the Backend.

  1. To configure the python environment, from the pgadmin directory, create a virtual environment and activate this environment by running this command.

    cd ..
    python -m virtualenv penv # creates a virtual environment
    source penv/Scripts/activate #activates the virtual environment
    
  2. Upgrade to the latest version of pip if you are not using one already, as pgAdmin requires the latest version via this command below.

    pip install --upgrade pip
    
  3. Add the part to your Postgres bin directory to your environment variables by running this command, this is necessary so pg-config can be found for building psycopg3.

    export PATH="$PATH:/c/Program Files/PostgreSQL/15/bin"
    

    This path, is the path to the PostgreSQL 15 I installed via the Windows installer. You can replace 15 with any version that you have.

  4. Install the dependencies by running this command.

    pip install -r requirements.txt
    
  5. Start the server by running the command below.

    python pgAdmin.py
    
  6. Finally, this Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser. will be seen on the terminal, which shows the server has started Happy coding.

References
https://github.com/pgadmin-org/pgadmin4
Please do give me a like and a follow if you enjoyed this blogpost.

Top comments (0)