pytest-postgresql icon indicating copy to clipboard operation
pytest-postgresql copied to clipboard

FileNotFoundError: [Errno 2] No such file or directory: 'pg_config'

Open alac1984 opened this issue 3 years ago • 3 comments

What action do you want to perform

I want to run my tests with postgresql fixture as usual.

What are the results

When I run pytest, I get this error:

/usr/lib/python3.9/subprocess.py:1821: FileNotFoundError
=============================== short test summary info ================================
ERROR tests/test_main.py::test_hello - FileNotFoundError: [Errno 2] No such file or directory: 'pg_config'
================================= 1 error in 0.13s ====================================

When I was developing in Ubuntu 20.04, everything worked just fine. Before I install my new Pop OS 22.04 I've pushed the repo to Github and after installation, I've cloned it.

What are the expected results

That the tests run without a problem whatsoever.

alac1984 avatar Apr 28 '22 23:04 alac1984

@alac1984 do you have libpq-dev installed?

fizyk avatar Apr 29 '22 07:04 fizyk

Yes, libpq-dev is installed (14.2-1ubuntu1). python3-dev is installed also. PostgreSQL 14 is of course installed and pg_config command can be run from terminal as usual. Some very specific thing in Pop OS 22.04 should be misplaced, and I really don't get what.

alac1984 avatar Apr 29 '22 12:04 alac1984

not sure, maybe the pg_config isn't being added to $PATH libpq-dev is the one that should deliver pg_config 🤔

fizyk avatar Apr 30 '22 22:04 fizyk

Was this ever resolved? I'm running into this issue too on Mac OS Sonoma. I would have thought pytest-postgresql was installing everything it needed as a dependency, including libpq-dev.

I'm getting the error pytest_postgresql.exceptions.ExecutableMissingException: Could not found pg_config executable. Is it in systenm $PATH? while also using the psycopg2-binary

GroomedGorilla avatar Feb 23 '24 18:02 GroomedGorilla

@GroomedGorilla pytest-postgresql 4.x and later work on psycopg 3.x And libpq-dev is system dependency. You need to install it yourself.

fizyk avatar Feb 26 '24 09:02 fizyk