Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can not install psycopg2 on macOS Catalina

when installing psycopg2 in my Django project

pip install psycopg2==2.7.*

I get this error :

psycopg/psycopgmodule.c:689:18: error: incomplete definition of type 'struct _is'

I tried the answer to the following question: Is there any problem installing psycopg2 in virtualenv on MacOS catalina with PostgreSQL 12.1 installed? but I still get the same error

like image 842
Adama OUEDRAOGO Avatar asked Jan 04 '20 23:01

Adama OUEDRAOGO


People also ask

Does psycopg2 work with python3?

The current psycopg2 implementation supports: Python 2 versions from 2.6 to 2.7. Python 3 versions from 3.2 to 3.6. PostgreSQL server versions from 7.4 to 9.6.

Is psycopg2 a package?

The psycopg2 package is the current mature implementation of the adapter: it is a C extension and as such it is only compatible with CPython.

How do I know what version of psycopg2 I have?

To check which version of psycopg2-binary is installed, use pip show psycopg2-binary or pip3 show psycopg2-binary in your CMD/Powershell (Windows), or terminal (macOS/Linux/Ubuntu) to obtain the output major.


2 Answers

Installing psycopg2-binary worked for me.

like image 198
egoens Avatar answered Oct 20 '22 02:10

egoens


If you are using Python 3.8.x then the support for the same was added in psycopg2 2.8.x. I faced the same problem but worked out fine once I switched to python 3.7.x

like image 27
Vaibhav Khulbe Avatar answered Oct 20 '22 01:10

Vaibhav Khulbe