Skip to content

ImportError when running flask run on finesse-backend #70

@elwoujdi

Description

@elwoujdi

When attempting to launch the application with flask run in the finesse-backend repository, an ImportError related to the psycopg library is triggered. It is important to note that the finesse-backend repository does not directly use psycopg, but it imports the GitHub repository ailab-db, which does make use of this library.

How to reproduce the problem:

  1. Clone the finesse-backend repository.
  2. Set up the repository by following the INSTALLATION.md protocol.
  3. Run flask run in the terminal.

Error log:

Ibrahim Kabir@Hignir-Laptop MINGW64 ~/ACIA/finesse-backend (27-swagger-doc)
$ python run.py
Traceback (most recent call last):
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\run.py", line 1, in <module>
    from app import app
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\app\__init__.py", line 5, in <module>
    app = create_app(configuration)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\app\app_creator.py", line 13, in create_app
    from .blueprints.search import search_blueprint
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\app\blueprints\search.py", line 6, in <module>
    from app.ailab_db import DBError, ailab_db_search
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\app\ailab_db\__init__.py", line 3, in <module>
    from ailab.db import DBError, connect_db
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\venv\Lib\site-packages\ailab\db\__init__.py", line 7, in <module>
    import psycopg
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\venv\Lib\site-packages\psycopg\__init__.py", line 9, in <module>
    from . import pq  # noqa: F401 import early to stabilize side effects
    ^^^^^^^^^^^^^^^^
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\venv\Lib\site-packages\psycopg\pq\__init__.py", line 114, in <module>
    import_from_libpq()
  File "C:\Users\Ibrahim Kabir\ACIA\finesse-backend\venv\Lib\site-packages\psycopg\pq\__init__.py", line 106, in import_from_libpq
    raise ImportError(
ImportError: no pq wrapper available.
Attempts made:
- couldn't import psycopg 'c' implementation: No module named 'psycopg_c'
- couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary'
- couldn't import psycopg 'python' implementation: libpq library not found

Tasks:

  • Analyze the ailab-db repository to identify what's causing the problem.
  • Implement a solution in the ailab-db repository to avoid the necessity for finesse-backend to download psycopg.
  • Test the implemented solution by reproducing the problem in finesse-backend after making the necessary adjustments.

Acceptance Criteria:

  • Dependencies of ailab-db repository is reviewed.
  • The implemented solution is tested, and finesse-backend successfully runs without the psycopg-related ImportError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions