Obsolete Python docs, and mismatch between Python client and server running in Docker

Hello,

I’m making one thread out of these two issues because they seem very related.

Everything described below I discovered by running tweaks of the QuickStart script[1] in an iPython shell from within the TypeDB docker container (called “vaticle/typedb”, with image ID 0f332410e5cb, up to date according to DockerHub as of today).

Some obsolete documentation

The first instruction at the Overview[1] of the Python driver is to run pip install typedb-driver. That package is no longer in PyPi, but typedb-client is, so I installed the latter.

The QuickStart goes on to suggest some code, starting with from typedb.driver import TypeDB, SessionType, TransactionType. That module does not exist, but typedb.client does, and those types are all available within it.

Once I replaced every instance of the string “driver” to “client” (the two important targets being the module typedb.driver and the object TypeDB.core_driver), I was able to execute the script – which uncovered the second issue.

Version mismatch

Running that QuickStart code resulted in an error, the money quote from which appears to be the following:

_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INTERNAL
        details = "[SRV26] Invalid Server Operation: A protocol version mismat
ch was detected. This server supports version '3' but the driver supports vers
ion '1'. Please use a compatible driver to connect.

[1] TypeDB | Docs > TypeDB drivers > Python driver

Hi Jeff,
You’ll want to check the compatibility versions of the driver and server in the compatibility table

TypeDB Client was renamed to TypeDB driver from version 2.19 onwards. Here is typedb-driver on pypi: typedb-driver · PyPI
As the error message suggests, the driver (typedb-client, likely 2.18.2 with protocol version 1) you’ve installed is indeed two protocol versions behind the current server ( 2.28.3 with protocol version 3).
Could you try installing it again, and if it doesn’t work, let us know what version of python + platform you’re using?

Thanks a lot! With your help I got it working.

Solution

I built a new Docker image. The Dockerfile and pip requirements file for it are here:

That uses Ubuntu 23.11, which is the latest image for which the default version of Python is 3.11 (the most recent that the TypeDB driver is compatible with). That compatibility chart you linked to was critical – otherwise I would have been stumped, not realizing that Python 3.12 is too new.

What the problem was … maybe

I had been TypeDB from the Docker image that you provide:
https://hub.docker.com/layers/vaticle/typedb/latest/images/sha256-b62f455c89fb1a31ee7c1ec0af9f2b5ed452a6507b594f7447b5df9f2f92313f

From that image, when I run pip install typedb-driver I would get a can't find it error:

root@26f767b4e868:/opt/typedb-all-linux-x86_64# pip install typedb-driver
ERROR: Could not find a version that satisfies the requirement typedb-driver (from versions: none)
ERROR: No matching distribution found for typedb-driver
root@26f767b4e868:/opt/typedb-all-linux-x86_64#

It might be because that Docker image uses a four-year-old version of Ubuntu:

root@26f767b4e868:/opt/typedb-all-linux-x86_64# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"

But maybe it was something else.

1 Like

That’s a use case for our docker image we didn’t really expect.
We expected it to be used to just run the TypeDB server, and the driver/clients would run on the user’s host machines.

Interesting - indeed this is not what we had envisioned. We’re planning on releasing a Python driver that works with 3.12 of Python soon-ish as well.

I see, that makes sense. The reason I’m doing it this way is I that use NixOS, and the TypeDB driver (at least the Python one) is not packaged for NixOS. (I once managed to package something for NixOS, but it was hard, and I don’t have the kind of free time I used to.)

I’m still facing the same error: “[SRV26] Invalid Server Operation: A protocol version mismatch was detected. This server supports version ‘3’ but the driver supports version ‘1’.”
Python typedb client: typedb-client==2.18.2 running on local Python 3.11.9
docker image: vaticle/typedb-latest (version: 2.28.3, pulled 8. Sep 2024)

The doctor container I built might solve that problem. It did for me, anyway. You can find the recipe here:

https://github.com/JeffreyBenjaminBrown/hode6/tree/main/docker

Or you can just download the image, already built:

https://hub.docker.com/layers/jeffreybbrown/hode/latest/images/sha256-79bfcafbb27eb59c536c863e5904c6eff8616eb25f99a9f5cc4754f69690c162?context=explore

You need to use a newer driver version. Note that the package has been renamed to typedb-driver starting version 2.19.
So you’ll have to do: pip install typedb-driver

ah, thank you very much!

Dieter