memgraph / pymgclient

Python Memgraph Client
https://memgraph.github.io/pymgclient/
Apache License 2.0
43 stars 5 forks source link

openssl 3.0.2 #40

Closed alexanderbsd closed 2 years ago

alexanderbsd commented 2 years ago

Hi there,

I am getting this issue after trying to compile pymgclient on Ubuntu 22.04. Could you help please? thanks

ImportError:miniconda3/envs/eth/lib/python3.10/site-packages/mgclient.cpython-310-x86_64-linux-gnu.so: undefined symbol: SSL_get1_peer_certificate

antaljanosbenjamin commented 2 years ago

Hi @alexanderbsd,

Currently mgclient/pymgclient doesn't support Ubuntu 22.04 and OpenSSL 3. It was on our radar to make it work, but because of your request we will prioritize this one. Hopefully we can release a new version of pymgclient that supports OpenSSL 3 in the next two weeks. If no big changes are necessary in our code base, it is even possible that it will arrive this week.

In any case, I will keep you updated through this issue.

antaljanosbenjamin commented 2 years ago

After checking out what has changed in OpenSSL 3.0 based on the migration guide I would say the issue is not necessarily with OpenSSL 3.0 (I was able to compile pymgclient on an Ubuntu 22.04 docker container and connected to a Memgraph instance using SSL connections without any issues.

My assumption is pymgclient compiles with OpenSSL 3.0 without any issues, but when you try to load it, it somehow finds the OpenSSL 1.1.1 library. I will try to reproduce the issue on my machine and get back to you. In the meantime, could you please provide some information how did you install pymgclient?

alexanderbsd commented 2 years ago

You are right. Looks like conda comes with openssl-1.1.1 by default. I had to install openssl-3 from conda-forge and rebuild the package. All works right now, thank you.

antaljanosbenjamin commented 2 years ago

In the meantime I found a solution for the conflict between the OpenSSL version of conda and the operating system. I couldn't convince the conda based setuptools to use OpenSSL from OS, but I could managed to instruct the CMake config of mgclient to use the OpenSSL libraries from conda. However the default g++ will complain about some warnings, therefore I had to install clang-12, but after that the following command did the job:

CC=clang-12 CXX=clang++-12 OPENSSL_INCLUDE_DIR=/home/ubuntu/miniconda3/include OPENSSL_ROOT_DIR=/home/ubuntu/miniconda3 OPENSSL_LIBRARIES=/home/ubuntu/miniconda3/lib pip install pymgclient --no-cache

With the OPENSSL_XXX variables you can use a separate version of OpenSSL in your conda environment than the OpenSSL version of the OS in case of any of the packages doesn't work with OpenSSL 3.0.

I am already working on to update mgclient to work with the newest GCC version, so probably we can manage to release a new version of pymgclient that works without clang.

antaljanosbenjamin commented 2 years ago

The latest release, pymgclient 1.3.0 addresses the issue. You can also use PyPI to download pymgclient.

alexanderbsd commented 2 years ago

just upgraded - works well, no issues. Thanks!

antaljanosbenjamin commented 2 years ago

Glad to hear that! If you encounter any other issues, feel free to let us know again!

katarinasupe commented 10 months ago

Might be related: https://github.com/memgraph/gqlalchemy/issues/294, https://github.com/memgraph/pymgclient/issues/54