You Can Install PostgreSQL with conda?

Conda has long been the driver of data science workflows because of its unique ability to manage the complexities around Python packaging's diverse dependency requirements. It's precisely because of this that conda is also able to handle managing much more than Python dependencies.
In the first part of a multi-part blog post series, we'll show the strengths of conda's flexibility and provide a tutorial on how you can install PostgreSQL for local development environments.
Prerequisitesโ
Throughout this tutorial, we show you how to install and run PostgreSQL from conda-forge using either conda or pixi. Please refer to those project's documentation for information on how install them.
Setting up your environmentโ
To start, we'll create a new environment with all the required dependencies for install PostgreSQL. We'll also add a couple of PostgreSQL extensions: PostGIS and PGRouting.
- conda
- pixi
To create a new conda environment with PostgreSQL GIS extensions, run the following command:
conda create \
--name postgresql \
--channel conda-forge \
postgresql
To create a new pixi project with PostgreSQL and GIS extensions, run the following commands:
# Create your project directory first
mkdir postgresql && cd postgresql
# Initialize your pixi environment and add dependencies
pixi init && pixi add postgresql
You can also use pixi global to create a single installation of PostgreSQL that's available only to your user account:
pixi global install postgresql
Running PostgreSQLโ
Now that we have our environment setup and packages installed, we can initialize our database and get it running. The postgresql package exposes the following commands that we'll use to do that:
initdbcreateusercreatedbpg_ctl
TODOโ
Remaining items to include in the blog post:
- Running initdb
- Starting and stopping the server
- Making edits to the server configuration
- Notes of security
