Skip to content

Commit 2167eb9

Browse files
authored
Enhance README with pgcli installation guidance (#746)
Added instructions for resolving pgcli installation issues on Ubuntu, including setting up a virtual environment and installing necessary libraries.
1 parent d5d6026 commit 2167eb9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

01-docker-terraform/2_docker_sql/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ conda install -c conda-forge pgcli
8787
pip install -U mycli
8888
```
8989

90+
If you user Ubuntu: Ubuntu’s system Python (managed by apt) now prevents `pip` from installing packages globally to protect system integrity ([PEP 668]([url](https://peps.python.org/pep-0668/))). And additionally even if you installed pgcli with pip you will may get this error also `ImportError: no pq wrapper available... libpq library not found`
91+
Do the following ones step-by-step and will fix the error properly:
92+
```bash
93+
cd ~/Documents/dataTalksClub # Change it with your working directory
94+
python3 -m venv venv # Will create separate environment
95+
source venv/bin/activate # Activate newly created environment
96+
pip install pgcli # Install pgcli
97+
98+
# Run these commands:
99+
sudo apt update
100+
sudo apt install libpq-dev python3-dev
101+
102+
# Then reinstall psycopg inside your virtual environment to make it rebuild against the newly installed library:
103+
pip uninstall psycopg -y
104+
pip install psycopg[binary]
105+
# The [binary] extra installs a precompiled version of the libpq wrapper — no compilation needed.
106+
```
107+
90108
Using `pgcli` to connect to Postgres
91109

92110
```bash

0 commit comments

Comments
 (0)