gqlalchemy icon indicating copy to clipboard operation
gqlalchemy copied to clipboard

[BUG] : undefined symbol: `EVP_PKEY_base_id` (in `mgclient.cpython-39-x86_64-linux-gnu.so`)

Open Tim-K-DFW opened this issue 2 years ago • 19 comments

Memgraph version

v2.11.0

Environment

  • Linux 20.04 LTS,
  • conda with pip, clean environment with the only thing installed being gqlalchemy (using pip install gqlalchemy)
  • memgraph running in docker (docker run --name memgraph -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform)

Describe the bug

Fail to import, see log below; same thing happens whether memgraph is running or not.

To Reproduce

import gqlalchemy

Expected behavior

To import.

Logs

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[4], line 1
----> 1 import gqlalchemy

File ~/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/__init__.py:34
     19 from gqlalchemy.models import (  # noqa F401
     20     MemgraphConstraintExists,
     21     MemgraphConstraintUnique,
   (...)
     31     Field,
     32 )
     33 from gqlalchemy.disk_storage import SQLitePropertyDatabase  # noqa F401
---> 34 from gqlalchemy.instance_runner import (  # noqa F401
     35     DockerImage,
     36     MemgraphInstanceBinary,
     37     MemgraphInstanceDocker,
     38     wait_for_docker_container,
     39     wait_for_port,
     40 )
     41 from gqlalchemy.exceptions import GQLAlchemyError, GQLAlchemyWarning  # noqa F401
     43 from gqlalchemy.query_builders import (  # noqa F401
     44     neo4j_query_builder,
     45     memgraph_query_builder,
     46     memgraph_query_builder as query_builder,
     47 )

File ~/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/instance_runner.py:35
     27 import psutil
     29 from gqlalchemy.exceptions import (
     30     GQLAlchemyWaitForConnectionError,
     31     GQLAlchemyWaitForDockerError,
     32     GQLAlchemyWaitForPortError,
     33     raise_if_not_imported,
     34 )
---> 35 from gqlalchemy.vendors.memgraph import Memgraph
     38 MEMGRAPH_DEFAULT_BINARY_PATH = "/usr/lib/memgraph/memgraph"
     39 MEMGRAPH_DEFAULT_PORT = 7687

File ~/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/vendors/memgraph.py:19
     16 import sqlite3
     17 from typing import List, Optional, Union
---> 19 from gqlalchemy.connection import Connection, MemgraphConnection
     20 from gqlalchemy.disk_storage import OnDiskPropertyDatabase
     21 from gqlalchemy.exceptions import (
     22     GQLAlchemyError,
     23     GQLAlchemyFileNotFoundError,
     24     GQLAlchemyOnDiskPropertyDatabaseNotDefinedError,
     25     GQLAlchemyUniquenessConstraintError,
     26 )

File ~/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/connection.py:18
     15 from abc import ABC, abstractmethod
     16 from typing import Any, Dict, Iterator, Optional
---> 18 import mgclient
     19 from neo4j import GraphDatabase
     20 from neo4j.graph import Node as Neo4jNode

ImportError: /home/t/miniconda3/envs/memgraph/lib/python3.9/site-packages/mgclient.cpython-39-x86_64-linux-gnu.so: undefined symbol: EVP_PKEY_base_id

Additional context Add any other context about the problem here.

Tim-K-DFW avatar Sep 25 '23 16:09 Tim-K-DFW

Hi @Tim-K-DFW, can you try pip install GQLAlchemy==1.4.1 until we detect if this is a bug related to latest release? Btw as far as I can see, you're using Python 3.9?

katarinasupe avatar Sep 25 '23 16:09 katarinasupe

Hi Katarina, thank you for the quick response!

  • Same result with 1.4.1
  • Yes, python 3.9.16.

Tim-K-DFW avatar Sep 26 '23 13:09 Tim-K-DFW

Did you experience any issues when installing with pip? Also when you installed can you confirm installation is okay by running pip show gqlalchemy and provide output? P.S. I see you are using Linux OS but is this a virtual machine or not? Wondering about your device architecture, is it ARM or AMD?

katarinasupe avatar Sep 26 '23 13:09 katarinasupe

  1. The only issue first time was pip complaining of cmake missing, so I installed that, and then gqlalchemy installed with no problems.

  2. pip show gqlalchemy gives:

Python 3.9.16
(memgraph) t@DESKTOP-KHJBONB:~/ro5_wsl/memgraph$ pip show gqlalchemy
Name: gqlalchemy
Version: 1.4.1
Summary: GQLAlchemy is a library developed to assist with writing and running queries in Memgraph.
Home-page: https://github.com/memgraph/gqlalchemy
Author: Bruno Sacaric
Author-email: [email protected]
License: Apache-2.0
Location: /home/t/miniconda3/envs/memgraph/lib/python3.9/site-packages
Requires: adlfs, dacite, docker, neo4j, networkx, numpy, psutil, pydantic, pymgclient
Required-by:
(memgraph) t@DESKTOP-KHJBONB:~/ro5_wsl/memgraph$
  1. This is WSL2 on a Windows 10 machine, standard Intel CPU (AMD architecture as I understand).

Tim-K-DFW avatar Sep 26 '23 14:09 Tim-K-DFW

Can you remove that installation, install all necessary prerequisites for GQLAlchemy (that is, pymgclient) and then try reinstalling it?

katarinasupe avatar Sep 26 '23 14:09 katarinasupe

I did:

  • new conda env with python 3.9.16
  • sudo apt install python3-dev cmake make gcc g++ libssl-dev (from your link)
  • pip3 install --user pymgclient (from your link)
  • pip install GQLAlchemy==1.4.1

Same result:

$ python
Python 3.9.16 (main, May 15 2023, 23:46:34)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gqlalchemy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/t/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/__init__.py", line 34, in <module>
    from gqlalchemy.instance_runner import (  # noqa F401
  File "/home/t/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/instance_runner.py", line 31, in <module>
    from gqlalchemy.vendors.memgraph import Memgraph
  File "/home/t/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/vendors/memgraph.py", line 19, in <module>
    from gqlalchemy.connection import Connection, MemgraphConnection
  File "/home/t/miniconda3/envs/memgraph/lib/python3.9/site-packages/gqlalchemy/connection.py", line 18, in <module>
    import mgclient
ImportError: /home/t/.local/lib/python3.9/site-packages/mgclient.cpython-39-x86_64-linux-gnu.so: undefined symbol: EVP_PKEY_base_id
>>>

Tim-K-DFW avatar Sep 26 '23 14:09 Tim-K-DFW

I think that might be related to the mismatch of the OpenSSL version. Can you tell me which version you have?

katarinasupe avatar Sep 26 '23 14:09 katarinasupe

image

Tim-K-DFW avatar Sep 26 '23 14:09 Tim-K-DFW

Are you sure that conda env uses that OpenSSL by default? This reminds me of the closed issue on the pymgclient repository.

katarinasupe avatar Sep 26 '23 14:09 katarinasupe

Do you happen to know how I can check this?

Tim-K-DFW avatar Sep 26 '23 14:09 Tim-K-DFW

(I mean, pip show openssl in this environment doesn't show any versions of openssl installed).

image

Tim-K-DFW avatar Sep 26 '23 14:09 Tim-K-DFW

Can you try installing the pymgclient prerequisites in conda env with pip? The steps in conda env would be:

pip3 install python3-dev cmake make gcc g++ libssl-dev
pip3 install pymgclient
pip3 install gqlalchemy==1.4.1

katarinasupe avatar Sep 26 '23 14:09 katarinasupe

ERROR: Invalid requirement: 'g++' 😬 I googled a few solution options but not sure what exactly you had in mind.

Tim-K-DFW avatar Sep 26 '23 14:09 Tim-K-DFW

My mistake on pip side. But the issue you're facing should be related to conda. I will do more research on what happened tomorrow and get back to you. Meanwhile, I recommend you read the issue I provided that might help and see why OpenSSL is not visible in your conda env.

katarinasupe avatar Sep 26 '23 15:09 katarinasupe

Can you try installing gqlalchemy without conda, to verify the assumption?

katarinasupe avatar Sep 26 '23 15:09 katarinasupe

YES! In vanilla python, it's importing with no issues. This has to be some Conda stuff. Thank you so much!

Tim-K-DFW avatar Sep 26 '23 15:09 Tim-K-DFW

No problem, I'm glad to help and happy it's working for you now! I will leave this issue open to resolve conda issues 😄

katarinasupe avatar Sep 26 '23 15:09 katarinasupe

Investigated the issue, you are probably having locally old version of pymgclient. Clean pymgclient from global path (pip uninstall pymgclient gqlalchemy), activate your conda environmen and install ONLY gqlalchemy (pip install gqlalchemy). You should see that pymgclient 1.3.1 is being built while installing gqlalchemy. No need to install pymgclient before gqlalchemy, we have wrong instructions in README, we will fix it.

as51340 avatar Dec 21 '23 13:12 as51340

@Tim-K-DFW let us know if you decide to try out Conda env again and verify if what @as51340 provided fixes the issue 😄 Thanks!

katarinasupe avatar Dec 21 '23 14:12 katarinasupe