Reputation: 69
the error:
Skipping optional fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.1 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=110500 -DHAVE_LO64=1 -I/usr/local/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/11/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
psycopg/psycopgmodule.c:685:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
while (interp->next)
^~
error: command 'gcc' failed with exit status 1
When I build the dockerc-compose to pip install psycopg2 and has the issue.
The Dockerfile:
RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list
RUN cat /etc/apt/sources.list
RUN apt-get clean && apt-get update
RUN apt-get install -y python3-dev \
&& apt-get install -y libevent-dev \
&& pip install --default-timeout=1000 --no-cache-dir -r requirements.txt
Upvotes: 1
Views: 3927
Reputation: 13931
You are trying to build psycopg2 version 2.7.3.1: that version is not compatible with Python 3.8.
You must use psycopg2 version at least 2.8.4.
https://www.psycopg.org/docs/news.html#what-s-new-in-psycopg-2-8-4
Upvotes: 4