khaoula zardoum
khaoula zardoum

Reputation: 61

Owlready2 optimized not available

I try to open the ontology with python but there is an error

here is the code:

from owlready2 import *
onto = get_ontology("http://www.lesfleursdunormal.fr/static/_downloads/pizza_onto.owl")
onto.load()

and here the error:

C:\Users\Khaoula\AppData\Local\Programs\Python\Python37\python.exe C:/Users/Khaoula/PycharmProject/project1/resume.py
* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Process finished with exit code 0

Is there any solution?
thank you in advance.

Upvotes: 5

Views: 4809

Answers (2)

Jesse
Jesse

Reputation: 3393

Using conda would be a simpler method.

conda install -c conda-forge owlready2

Search and you will find installation guild in https://anaconda.org/conda-forge/owlready2

Upvotes: 1

Gireesh
Gireesh

Reputation: 498

Reference

Owlready2 include an optimized Cython module. This module speeds up by about 20% the loading of large ontologies, but its use is entirely optional. To build this module, you need a C compiler, and to install the ‘cython’ Python package.

Most linux systems comes with C compilers by default. For me just installing the Cython before installing owlready2 has done the trick.

pip install Cython
pip install owlready2

For windows, download the Cython wheel file from the below link if pip install Cython failed

https://www.lfd.uci.edu/~gohlke/pythonlibs/#cython

pip install Cython_wheel_file.whl
# Example
pip install Cython‑0.29.21‑cp38‑cp38‑win32.whl

Note: if you get following message installing owlready2
error: invalid command 'bdist_wheel'
 ----------------------------------------
  ERROR: Failed building wheel for owlready2
  Running setup.py clean for owlready2
Failed to build owlready2
Installing collected packages: owlready2
    Running setup.py install for owlready2 ... done
Successfully installed owlready2-0.31

Then owlready2 is installed but if you don't want to get this error further,then uninstall owlready2 and install wheel package and reinstall owlready2

pip uninstall owlready2
pip install wheel
pip install owlready2

Upvotes: 6

Related Questions