borgia-app / Borgia-docs

Apache License 2.0
6 stars 4 forks source link

Issue with "pip3 install -r requirements/prod.txt " #9

Open BRUCH05 opened 2 days ago

BRUCH05 commented 2 days ago

Hello,

During this execution, I get this issue. All the previous commands from production installation tuto works fine. Any idea ?

Thx by advance Regards Christophe

Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 "-DPSYCOPG_VERSION=2.7.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=140013 -DHAVE_LO64=1 -I/borgia-app/borgiaenv/include -I/usr/include/python3.10 -I. -I/usr/include/postgresql -I/usr/include/postgresql/14/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-cpython-310/psycopg/psycopgmodule.o -Wdeclaration-after-statement psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’: psycopg/psycopgmodule.c:689:18: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’} 689 | while (interp->next) | ^~ psycopg/psycopgmodule.c:690:24: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’} 690 | interp = interp->next; | ^~ error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for psycopg2 Running setup.py clean for psycopg2 Failed to build psycopg2 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (psycopg2) (borgiaenv) root@test:/borgia-app/Borgia#

Eyap53 commented 2 days ago

ERRATUM :

The error you are encountering is related to building the psycopg2 package, a PostgreSQL adapter for Python. Please read the current PR #7. I suppose it is related.

Here is the translation :

In production, there are inconsistencies in the installation method.

The credentials for the first account are not specified, I’ve added them.
The primary key for the first user is pk=1, I’ve made the necessary correction.
Installing psycopg via requirements.txt throws an exception (SEGMENTATION FAULT) when loading pages; manually installing it without the wheel, using the binaries, simply solves the problem, so I’ve corrected the installation document. => We could perhaps directly correct the requirements.txt.
The structure of rc.local wasn’t clear, and it was missing the step to make it executable.
BRUCH05 commented 2 days ago

Hello

Thx for your quick answer.

Please found my answers in red below. The issue is still present.

Best regards

C. BRUGEL

IT MANAGER – Aeroclub Brocard – Etampes – France

De : Mael Lacour @.> Envoyé : jeudi 17 octobre 2024 15:45 À : borgia-app/Borgia-docs @.> Cc : BRUCH05 @.>; Author @.> Objet : Re: [borgia-app/Borgia-docs] Issue with "pip3 install -r requirements/prod.txt " (Issue #9)

Here is what ChatGpt is saying, after providing some more context information :

The error you are encountering is related to building the psycopg2 package, a PostgreSQL adapter for Python. The issue seems to stem from the fact that the source code is not compatible with your current Python or PostgreSQL versions.

Here are some potential causes:

  1. Incompatibility with Python version: The error indicates the use of PyInterpreterState, which has undergone changes between Python versions, particularly from Python 3.9 to 3.10. If psycopg2 is not updated to handle this change, you may encounter this issue.

Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux

psycopg2==2.9.10 ==> Last version installed

  1. PostgreSQL version mismatch: The line PG_VERSION_NUM=140013 indicates you're using PostgreSQL 14. The psycopg2 version being built (2.7.6.1) may not fully support this version of PostgreSQL. You may need to update to a newer version of psycopg2 that is compatible with PostgreSQL 14.

PostgreSQL 14.13 (Ubuntu 14.13-0ubuntu0.22.04.1)

psycopg2==2.9.10 ==> Last version installed

  1. Building from source issues: The error points to a failure in compiling the psycopg2 module using gcc. You may need to ensure that the required build dependencies (such as PostgreSQL development libraries and Python development headers) are correctly installed.

Possible fixes:

  1. Upgrade psycopg2: You can try upgrading to a newer version of psycopg2, which may have fixed compatibility issues with Python 3.10 and PostgreSQL 14.

pip install psycopg2 –upgrade ==> Done

  1. Install psycopg2-binary: Instead of building from source, you can install a precompiled version of psycopg2 to avoid build issues:

pip install psycopg2-binary ==> Done

  1. Ensure dependencies are installed: Make sure you have the PostgreSQL and Python development headers installed:

sudo apt-get install libpq-dev python3-dev ==> Already done

Issue log.

-DPG_VERSION_NUM=140013 -DHAVE_LO64=1 -I/borgia-app/borgiaenv/include -I/usr/include/python3.10 -I. -I/usr/include/postgresql -I/usr/include/postgresql/14/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-cpython-310/psycopg/psycopgmodule.o -Wdeclaration-after-statement psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’: psycopg/psycopgmodule.c:689:18: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’} 689 | while (interp->next) | ^~ psycopg/psycopgmodule.c:690:24: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’} 690 | interp = interp->next; | ^~ error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for psycopg2 Running setup.py clean for psycopg2 Failed to build psycopg2 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (psycopg2)


Could you try some of these steps and see how it goes ?

— Reply to this email directly, view it on GitHub https://github.com/borgia-app/Borgia-docs/issues/9#issuecomment-2419593159 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZZSJ2C73FNPJ43SBS7OBDZ365PRAVCNFSM6AAAAABQDQX2EGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJZGU4TGMJVHE . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AFZZSJ4TLL5UGSTXPHVKEETZ365PRA5CNFSM6AAAAABQDQX2EGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUQHAH4O.gif Message ID: @. @.> >

Eyap53 commented 1 day ago

Hi, Did you check my updated answer ?