topoteretes / cognee

Reliable LLM Memory for AI Applications and AI Agents
https://www.cognee.ai
Apache License 2.0
822 stars 57 forks source link

AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'. Did you mean: 'X509_V_FLAG_EXPLICIT_POLICY'? #116

Closed chenggangqcg closed 3 months ago

chenggangqcg commented 3 months ago

Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:12:31) [Clang 14.0.6 ] on darwin Type "help", "copyright", "credits" or "license" for more information.

import cognee Traceback (most recent call last): File "", line 1, in File "/Users/doudou/project/cognee/cognee/cognee/init.py", line 3, in from .api.v1.cognify.cognify import cognify File "/Users/doudou/project/cognee/cognee/cognee/api/v1/cognify/cognify.py", line 29, in from cognee.modules.data.get_layer_graphs import get_layer_graphs File "/Users/doudou/project/cognee/cognee/cognee/modules/data/get_layer_graphs.py", line 4, in from .extraction.knowledge_graph.extract_knowledge_graph import extract_knowledge_graph File "/Users/doudou/project/cognee/cognee/cognee/modules/data/extraction/knowledge_graph/extract_knowledge_graph.py", line 4, in from .extract_knowledge_graph_module import ExtractKnowledgeGraph File "/Users/doudou/project/cognee/cognee/cognee/modules/data/extraction/knowledge_graph/extract_knowledge_graph_module.py", line 2, in import dspy File "/Users/doudou/miniconda3/lib/python3.10/site-packages/dspy/init.py", line 1, in import dsp File "/Users/doudou/miniconda3/lib/python3.10/site-packages/dsp/init.py", line 1, in from .modules import File "/Users/doudou/miniconda3/lib/python3.10/site-packages/dsp/modules/init.py", line 14, in from .google import File "/Users/doudou/miniconda3/lib/python3.10/site-packages/dsp/modules/google.py", line 10, in import google.generativeai as genai File "/Users/doudou/miniconda3/lib/python3.10/site-packages/google/generativeai/init.py", line 45, in from google.generativeai import types File "/Users/doudou/miniconda3/lib/python3.10/site-packages/google/generativeai/types/init.py", line 18, in from google.generativeai.types.content_types import * File "/Users/doudou/miniconda3/lib/python3.10/site-packages/google/generativeai/types/content_types.py", line 28, in from google.generativeai.types import file_types File "/Users/doudou/miniconda3/lib/python3.10/site-packages/google/generativeai/types/file_types.py", line 19, in from google.generativeai.client import get_default_file_client File "/Users/doudou/miniconda3/lib/python3.10/site-packages/google/generativeai/client.py", line 19, in import googleapiclient.http File "/Users/doudou/miniconda3/lib/python3.10/site-packages/googleapiclient/http.py", line 53, in from googleapiclient import _auth File "/Users/doudou/miniconda3/lib/python3.10/site-packages/googleapiclient/_auth.py", line 34, in import oauth2client.client File "/Users/doudou/miniconda3/lib/python3.10/site-packages/oauth2client/client.py", line 45, in from oauth2client import crypt File "/Users/doudou/miniconda3/lib/python3.10/site-packages/oauth2client/crypt.py", line 45, in from oauth2client import _openssl_crypt File "/Users/doudou/miniconda3/lib/python3.10/site-packages/oauth2client/_openssl_crypt.py", line 16, in from OpenSSL import crypto File "/Users/doudou/miniconda3/lib/python3.10/site-packages/OpenSSL/init.py", line 8, in from OpenSSL import crypto, SSL File "/Users/doudou/miniconda3/lib/python3.10/site-packages/OpenSSL/crypto.py", line 1570, in class X509StoreFlags(object): File "/Users/doudou/miniconda3/lib/python3.10/site-packages/OpenSSL/crypto.py", line 1589, in X509StoreFlags NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'. Did you mean: 'X509_V_FLAG_EXPLICIT_POLICY'?

Vasilije1990 commented 3 months ago

Can you give me your OS, etc?

chenggangqcg commented 3 months ago

macos pyOpenSSL version is 22.0.0 Python 3.10.10

chenggangqcg commented 3 months ago

update my pyOpenSSL to 24.1.0, fixed. thanks

chenggangqcg commented 3 months ago

while I run:

  1 import cognee
  2
  3 cognee.config.llm_api_key = "sk-XXX"
  4 cognee.config.llm_endpoint = "https://XXX"
  5
  6 cognee.config.set_graphistry_username = "XXX"
  7 cognee.config.set_graphistry_password = "XXX"
  8
  9 text = """Natural language processing (NLP) is an interdisciplinary
 10        subfield of computer science and information retrieval"""
 11
 12 cognee.add(text) # Add a new piece of information
 13
 14 cognee.cognify() # Use LLMs and cognee to create knowledge
 15
 16 search_results = cognee.search("SIMILARITY", {'query': 'Tell me about NLP'}) # Query cognee for the knowledge
 17
 18 for result_text in search_results[0]:
 19     print(result_text)

Got the error:

/Users/doudou/project/cognee/test.py:12: RuntimeWarning: coroutine 'add' was never awaited cognee.add(text) # Add a new piece of information RuntimeWarning: Enable tracemalloc to get the object allocation traceback /Users/doudou/project/cognee/test.py:14: RuntimeWarning: coroutine 'cognify' was never awaited cognee.cognify() # Use LLMs and cognee to create knowledge RuntimeWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last): File "/Users/doudou/project/cognee/test.py", line 18, in for result_text in search_results[0]: TypeError: 'coroutine' object is not subscriptable sys:1: RuntimeWarning: coroutine 'search' was never awaited

Vasilije1990 commented 3 months ago

We did a release to remove dspy. Best use fresh env to run cognee As for the problem, run it as an async function and await.

chenggangqcg commented 3 months ago

I used the lastest version v0.1.13, still got this error

Vasilije1990 commented 3 months ago

We've got tests building and running a simple pipeline, they passed from what I got. I will ask @borisarzentar to look into it. Thanks for raising the issue!

borisarzentar commented 3 months ago

while I run:

  1 import cognee
  2
  3 cognee.config.llm_api_key = "sk-XXX"
  4 cognee.config.llm_endpoint = "https://XXX"
  5
  6 cognee.config.set_graphistry_username = "XXX"
  7 cognee.config.set_graphistry_password = "XXX"
  8
  9 text = """Natural language processing (NLP) is an interdisciplinary
 10        subfield of computer science and information retrieval"""
 11
 12 cognee.add(text) # Add a new piece of information
 13
 14 cognee.cognify() # Use LLMs and cognee to create knowledge
 15
 16 search_results = cognee.search("SIMILARITY", {'query': 'Tell me about NLP'}) # Query cognee for the knowledge
 17
 18 for result_text in search_results[0]:
 19     print(result_text)

Got the error:

/Users/doudou/project/cognee/test.py:12: RuntimeWarning: coroutine 'add' was never awaited cognee.add(text) # Add a new piece of information RuntimeWarning: Enable tracemalloc to get the object allocation traceback /Users/doudou/project/cognee/test.py:14: RuntimeWarning: coroutine 'cognify' was never awaited cognee.cognify() # Use LLMs and cognee to create knowledge RuntimeWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last): File "/Users/doudou/project/cognee/test.py", line 18, in for result_text in search_results[0]: TypeError: 'coroutine' object is not subscriptable sys:1: RuntimeWarning: coroutine 'search' was never awaited

@chenggangqcg add, cognify and search are asynchronous functions, they need to be awaited, like await cognee.add(text), await cognee.cognify() and search_results = await cognee.search(....)

chenggangqcg commented 3 months ago

Got it;

The sample is copied from the Readme in the repo. Maybe you should changed it.

Thanks!

Vasilije1990 commented 3 months ago

Done