memgraph/memgraph

Cannot connect to authless memgraph instance w/ neo4j python driver

lucasprograms opened this issue ยท 6 comments

Memgraph version
2.7

Environment
Docker

Describe the bug
Connecting to memgraph with neo4j python driver fails with [Warning]The client didn't supply authentication information!

To Reproduce
Steps to reproduce the behavior:

  1. docker pull memgraph/memgraph
  2. docker run -it -p 7687:7687 -p 7444:7444 memgraph/memgraph
  3. set up the following python file (test_neo4j.py)
import neo4j

MEMGRAPH_URL = "bolt://localhost:7687"

driver = neo4j.GraphDatabase.driver(MEMGRAPH_URL, auth=None)


def find_one_node(tx):
    result = tx.run("MATCH (n) RETURN n LIMIT 1")
    return result.single()


with driver.session() as session:
    result = session.execute_read(find_one_node)
    print(result)
  1. pip install neo4j
  2. python test_neo4j.py

Expected behavior
Query returns no results as instance is empty

Logs

[2023-05-04 19:09:25.672][Warning]The client didn't supply authentication information!
[2023-05-04 19:09:25.673][Error]Exception was thrown while processing event in Bolt session associated with 172.17.0.1:38384

Additional context
I am attempting to use neo4j driver instead of pymgclient because the latter does not have a wheel build and is failing to install with following dockerfile:

FROM public.ecr.aws/lambda/python:3.10
ENV PACKAGE_PREFIX=/var/task
RUN yum install zip python3-devel cmake3 make gcc gcc-c++ openssl openssl-devel -y
COPY . ${PACKAGE_PREFIX}
RUN cd ${PACKAGE_PREFIX} && pip install -U pip && pip install -t ${PACKAGE_PREFIX}/ -r requirements.txt && zip -r9q /tmp/package.zip *

Hi @lucasprograms!

2 separate tracks here:

  • neo4j python driver -> I guess there is an issue with the version, Memgraph doesn't support v5 of Bolt yet (in the plans), we have a test with v4.1 under https://github.com/memgraph/memgraph/tree/master/tests/drivers/python/v4_1 + I think somebody also tested with v4.3 -> these versions should work, could you make it work with any of these?
  • pymgclient -> we plan to make an overhaul of the packets and make more of them available. Until then, what's error you get when you try to pip install?

Thanks! I will try w/ version 4.1 - appreciate the quick response.

For pymgclient, here is the error:

#0 6.309       CMake Error at /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
#0 6.309         Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
#0 6.309         system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
#0 6.309         version "1.0.2k")
#0 6.309       Call Stack (most recent call first):
#0 6.309         /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
#0 6.309         /usr/share/cmake3/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
#0 6.309         src/CMakeLists.txt:50 (find_package)

The fix for that according to https://stackoverflow.com/questions/16248775/cmake-not-able-to-find-openssl-library is to install openssl-devel, which is already being installed.

hey @gitbuda , I can confirm that it works with neo4j driver version 4.1.3, which also builds in the above dockerfile. Thanks again for the help!

Perfect!
I'll try to recreate the Docket pymgclient issue over the next few days. Somehow, on the specified image, cmake (run under pip install) fails to detect the OpenSSL...
In addition, this is +1 for adding the support for Bolt v5
Let's keep this issue open for a moment, based on it we'll take some actions ๐Ÿ˜„
Thanks!

@gitbuda is the bolt v5 issue confined to pymgclient, or would that also apply to e.g., the node neo4j-driver?

I haven't been able to try it out yet, but I think the answer is yes, so pymgclient also doesn't work with Memgraph if version 5 of the protocol is used. But, we kicked off the work on the server-side support for v5 yesterday, so as soon as we add the support server-side, the neo4j-driver will start to work. The idea is first to support v5.2 (the latest one) and then see do we have to support some of the older versions. Once that's done, we'll propagate the support to Memgraph clients as well. Will keep this issue updated ๐Ÿ˜„