-3

I am trying to install AGE via the python driver but it keeps giving me the same error.

Following the steps on the drivers/python/README.md. I starting getting errors after running

pip install --no-binary:all: psycopg2

it returned:

Failed to build psycopg2
ERROR: Could not build wheels for psycopg2, which is required to install pyproject toml-based projects

I installed psycopg2-binary instead and that went smoothly. However, while running the tests, it returned Exception: Could not deserialize ATN with version...... I tried to install but kept getting one of the errors.

How can I solve this?

Tito
  • 289
  • 8

6 Answers6

1

The error

Exception: Could not deserialize ATN with version.....

when running the tests using psycopg2-binary was because of a version mismatch of ANTLR runtime.

You can reference to a GitHub Issue I posted on the same error. You can solve this error by installing the required ANTLR runtime version as below:

    # When using the apache-age-python package
pip install antlr4-python3-runtime==4.9.2  

    # When importing age from the cloned repository 
pip install antlr4-python3-runtime==4.11.1
halfer
  • 19,824
  • 17
  • 99
  • 186
Safi50
  • 379
  • 1
  • 7
0

According to this answer you should not have both: psycopg2 and psycopg2-binary of the same version.

Try this:

  • Uninstall both psycopg2 and psycopg2-binary
  • Install the prerequsisites for building the psycopg2 package from source (Ubuntu):
    Python 3: sudo apt install libpq-dev python3-dev
    Python 2: sudo apt install libpq-dev python-dev

Then try the build command again: pip install psycopg2

In my case I have psycopg2 version: 2.9.5 and the AGE python driver works fine.

Ahmar
  • 584
  • 2
  • 7
0

You can try updating the PostgreSQL to latest. And see that the version matches with AGE library.

Prachi
  • 39
  • 3
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/34936140) – user16217248 Sep 03 '23 at 00:23
0

Since you have python 3.11 Install libpq library for python3, sudo apt install libpq-dev python3-dev then pip install psycopg2 and it should work fine.

Sarthak
  • 380
  • 7
0

The error you're getting definitely is concerning dependency issues with the package. Firstly, try to install all required dependencies.

sudo apt-get install build-essential libpq-dev

This will make sure your dependencies are up to date. Once that's done you can reinstall psycopg2, the commands for that are:

pip uninstall psycopg2 pip install psycopg2

This should help your case. If not, you can always try to install psycopg2 using the source code from git itself.

Shanzay
  • 19
  • 3
-1

You should check if you have correct version of python which is over python 3.9 . I hope this would solve your error.