Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not compatible with venv ? #313

Open
1 of 2 tasks
scenaristeur opened this issue May 28, 2023 · 1 comment
Open
1 of 2 tasks

not compatible with venv ? #313

scenaristeur opened this issue May 28, 2023 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@scenaristeur
Copy link

scenaristeur commented May 28, 2023

HI , i 've just installed kglab, but it does not seem to work in venv https://docs.python.org/3/library/venv.html, right ?

I'm submitting a

  • bug report.
  • feature request.

Current Behaviour:

in venv environnement, i got an issue importing _sqlite3 using this code found at https://derwen.ai/docs/kgl/start/#sample-usage

import kglab

kg = kglab.KnowledgeGraph()
kg.load_rdf("https://storage.googleapis.com/kglab-tutorial/foaf.rdf", format="xml")

measure = kglab.Measure()
measure.measure_graph(kg)

print("edges: {}\n".format(measure.get_edge_count()))
print("nodes: {}\n".format(measure.get_node_count()))

ttl = kg.save_rdf_text()
print(ttl)
(pyg_test) smag@smag-IdeaPad:~/dev/gnn/pyg_test/kgl_rdf$ python load_rdf.py 
Traceback (most recent call last):
  File "/home/smag/dev/gnn/pyg_test/kgl_rdf/load_rdf.py", line 1, in <module>
    import kglab
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/kglab/__init__.py", line 4, in <module>
    from .kglab import KnowledgeGraph
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/kglab/kglab.py", line 23, in <module>
    from .query.sparql import SparqlQueryable
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/kglab/query/sparql.py", line 13, in <module>
    import pyvis  # type: ignore  # pylint: disable=E0401
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/pyvis/__init__.py", line 1, in <module>
    from . import network
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/pyvis/network.py", line 10, in <module>
    from IPython.display import IFrame
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/IPython/__init__.py", line 54, in <module>
    from .terminal.embed import embed
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/IPython/terminal/embed.py", line 15, in <module>
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 73, in <module>
    from IPython.core.history import HistoryManager
  File "/home/smag/dev/gnn/pyg_test/lib/python3.10/site-packages/IPython/core/history.py", line 11, in <module>
    import sqlite3
  File "/usr/local/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

but it seems to work outside venv see below : top = inside venv, down = outside venv
Capture d’écran du 2023-05-28 11-58-07

Expected Behaviour:

Steps to reproduce:

Snapshot:

Environment:

  • python version 3.10.6
  • pip version : see picture
  • OS details : Linux Mint
@ceteri
Copy link
Collaborator

ceteri commented May 29, 2023

Hi @scenaristeur,

Thank you for the report. We don't use sqlite3 as a dependency in the kglab library, so I'm trying to figure out how that has come into the mix.

Currently, I'm running on macOS with Py 3.8.10 and that script produces:
ptr_sample.txt

It appears from the stack trace that IPython requires sqlite3, although that's not being referenced in the sample.py code. The use of IPython is only when pyvis gets used to visualize a graph, as far as I can tell.

Anecdotally, I've seen many issues reported in the transition to the 3.9 and 3.10 releases of Python which seem to be causing turmoil for a number packages, and perhaps now ours too?

I'll keep digging into this!

@ceteri ceteri self-assigned this Aug 8, 2023
@ceteri ceteri added the question Further information is requested label Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants