SuLab / WikidataIntegrator

A Wikidata Python module integrating the MediaWiki API and the Wikidata SPARQL endpoint
MIT License
244 stars 46 forks source link

example leads to import error #182

Closed WolfgangFahl closed 1 year ago

WolfgangFahl commented 2 years ago

Trying out our example which states:

from wikidataintegrator import wdi_core

i get the error message:

   from wikidataintegrator import wdi_core
  File "/Users/wf/Library/Python/3.9/lib/python/site-packages/wikidataintegrator/__init__.py", line 3, in <module>
    import wikidataintegrator.wdi_core
  File " .... /Library/Python/3.9/lib/python/site-packages/wikidataintegrator/wdi_core.py", line 14, in <module>
    from pyshex import ShExEvaluator
  File "... /Library/Python/3.9/lib/python/site-packages/pyshex/__init__.py", line 1, in <module>
    from pyshex.prefixlib import PrefixLibrary, standard_prefixes, known_prefixes
  File "... /Library/Python/3.9/lib/python/site-packages/pyshex/prefixlib.py", line 6, in <module>
    from rdflib.namespace import DOAP, FOAF, DC, DCTERMS, SKOS, OWL, XMLNS, _RDFNamespace
ImportError: cannot import name '_RDFNamespace' from 'rdflib.namespace' (/Users/wf/Library/Python/3.9/lib/python/site-packages/rdflib/namespace/__init__.py)

this is on python 3.9.6

pip list | grep wikidataintegrator
wikidataintegrator            0.9.19

I assume there might be an incompatibility with the most recent pyshex

pip list | grep -i pyshex
PyShEx                        0.7.14
PyShExC                       0.8.1
WolfgangFahl commented 2 years ago
bash
pip install -U pyshex
pip list | grep -i pyshex
PyShEx                        0.7.20
PyShExC                       0.8.3

fixed the problem - so you might want to state the minium necessary version in your requirements.txt