Problem import owlready2

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem import owlready2

Dumas Anthony
hi,

Sorry for my poor english, i'm french.
i m' using centos 6.3 and python 3.5.4.
pip install owlready result is ok.
but when i import owlready2, i got the result below :

>>> import owlready2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python3/lib/python3.5/site-packages/owlready2/__init__.py", line 105, in <module>
    default_world = IRIS = World()
  File "/opt/python3/lib/python3.5/site-packages/owlready2/namespace.py", line 224, in __init__
    self.graph = Graph(filename)
  File "/opt/python3/lib/python3.5/site-packages/owlready2/triplelite.py", line 55, in __init__
    self.execute("""CREATE TABLE resources (storid TEXT PRIMARY KEY, iri TEXT) WITHOUT ROWID""")
sqlite3.OperationalError: near "WITHOUT": syntax error

Why ?

and if i retry import owlready2, result below :

>>> import owlready2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python3/lib/python3.5/site-packages/owlready2/__init__.py", line 40, in <module>
    owlready2.namespace.EntityClass             = EntityClass
AttributeError: module 'owlready2' has no attribute 'namespace'

Do you have an idea ?

Tanks.
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Jiba
Administrator
Hello,

Could you give me the version of SQLite3 installed on your computer ?


> Sorry for my poor english, i'm french.

No problem, I'm French too :)
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
Thanks for your feedback !

i though i did not have sqlite installed but i s a mistake.
sqlite3 -version game me : 3.6.20
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Jiba
Administrator
I think you need SQLite3 3.8.2 or more (see http://sqlite.org/releaselog/3_8_2.html ) for having support for WITHOUT ROWID.

Version 3.8.2 is 4 year old, so it is quite surprising you don't have it... do you have any update available in CentOS ?
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
Tanks a lot !
unfortunatly my centos does not provide sqlite > 3.6.2

i will check if it's possible to update without destroying all my OS ;)

come back soon, tanks for your help.
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
hmm, just for information,

is there any possibility to indicate another instance of sqlite to python ?
this could resolve my issue.
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Jiba
Administrator
SQLite does run as a separate "instance", it is simply a library (.so file).

I think you can run Python with a different version using the LD_PRELOAD environment variable :

LD_PRELOAD=/path/to/custom/libsqlite3.so python ...

You just need a libsqlite3.so.xxx file ; I think you can easily compile a fresh one from SQLite source.
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
Tanks !

I will try as soon as possible.
thanks for debug !
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
Hello,

I'm back with some news (not good )

i got a fresh install of centos 7.4 1708, os updated with python 3.6.
manually updated sqlite3 : 3.7 to 3.2

>sqlite3 -version give me :
3.21.0 2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827

and the message is still the same :
>>> import owlready2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/owlready2/__init__.py", line 105, in <module>
    default_world = IRIS = World()
  File "/usr/lib/python3.6/site-packages/owlready2/namespace.py", line 224, in __init__
    self.graph = Graph(filename)
  File "/usr/lib/python3.6/site-packages/owlready2/triplelite.py", line 55, in __init__
    self.execute("""CREATE TABLE resources (storid TEXT PRIMARY KEY, iri TEXT) WITHOUT ROWID""")
sqlite3.OperationalError: near "WITHOUT": syntax error

did i miss something ?
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Jiba
Administrator
Bonjour,

Are you sure you are using the updated version of SQLite3 ? You can check with (in python) :

import sqlite3
print(sqlite3.sqlite_version)

Best regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13

> Hello,
>
> I'm back with some news (not good )
>
> i got a fresh install of centos 7.4 1708, os updated with python 3.6.
> manually updated sqlite3 : 3.7 to 3.2
>
> >sqlite3 -version give me :  
> 3.21.0 2017-10-24 18:55:49
> 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827
>
> and the message is still the same :
> >>> import owlready2  
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python3.6/site-packages/owlready2/__init__.py", line 105,
> in <module>
>     default_world = IRIS = World()
>   File "/usr/lib/python3.6/site-packages/owlready2/namespace.py", line 224,
> in __init__
>     self.graph = Graph(filename)
>   File "/usr/lib/python3.6/site-packages/owlready2/triplelite.py", line 55,
> in __init__
>     self.execute("""CREATE TABLE resources (storid TEXT PRIMARY KEY, iri
> TEXT) WITHOUT ROWID""")
> sqlite3.OperationalError: near "WITHOUT": syntax error
>
> did i miss something ?
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://owlready.8326.n8.nabble.com/Problem-import-owlready2-tp74p82.html
> To start a new topic under Owlready, email [hidden email]
> To unsubscribe from Owlready, visit
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
Hi,

whereis sqlite3 give me :

sqlite3: /usr/bin/sqlite3.7 /usr/bin/sqlite3 /usr/local/bin/sqlite3 /usr/share/man/man1/sqlite3.1.gz

/usr/bin/sqlite3 -version => 3.21
/usr/local/bin/sqlite3 -version => 3.21

effectively :
print(sqlite3.sqlite_version) => 3.7.17

do you know how to change path access from python to sqlite3 ?

thanks for helping (again !)

Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Jiba
Administrator
Hello,

> /usr/bin/sqlite3 -version => 3.21
> /usr/local/bin/sqlite3 -version => 3.21

This is for executable binaries, but you should rather check libraries (libsqlite3.so).

You can use LD_PRELOAD when running Python in order to specify the desired library.

SQLite3 is sometimes included in other binaries (= not used as a dynamic library). It may be the case for Python (not sure of that); in this case, you'll have to update/recompile Python too.

Kind regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13

> Hi,
>
> whereis sqlite3 give me :
>
> sqlite3: /usr/bin/sqlite3.7 /usr/bin/sqlite3 /usr/local/bin/sqlite3
> /usr/share/man/man1/sqlite3.1.gz
>
> /usr/bin/sqlite3 -version => 3.21
> /usr/local/bin/sqlite3 -version => 3.21
>
> effectively :
> print(sqlite3.sqlite_version) => 3.7.17
>
> do you know how to change path access from python to sqlite3 ?
>
> thanks for helping (again !)
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://owlready.8326.n8.nabble.com/Problem-import-owlready2-tp74p84.html
> To start a new topic under Owlready, email [hidden email]
> To unsubscribe from Owlready, visit
Reply | Threaded
Open this post in threaded view
|

Re: Problem import owlready2

Dumas Anthony
it's ok now !!
thanks for your time!

i have to execute
LDPRELOAD='/usr/local/lib/libsqlite3.so' python3.6
>>> print(sqlite3.sqlite_version)
>>> 3.21.0
>>> import owlready2
>>> WORKS !

now, i have to looking for a system to load the lib automatically.

bye and thanks or your help.
Problem solved.