python 3.5 amd64: spatialite initialization error

479 views
Skip to first unread message

צחי יעקובוביץ

unread,
Oct 7, 2015, 3:24:21 PM10/7/15
to SpatiaLite Users
This is a recap of a previous message as the heading was misleading:

I installed mod_spatialite 4.3 amd64 version.
 sqlite3  run and loaded the extension fine.
in Python 3.5, sqlite version is 3.8.11.
the following python code:

import sqlite3
conn = sqlite3.connect('d:\\sqlite_data\\test.db')
conn.enable_load_extension(True)
conn.execute("SELECT load_extension('mod_spatialite')")
 
after the "load_extension" I get the following error:

sqlite3.OperationalError: A dynamic link library (DLL) initialization routine failed.

Any pythonista using this config ? any ideas ?

Thanks in advance,
Tzahi

lydon_...@technologyonecorp.com

unread,
Oct 8, 2015, 5:46:42 AM10/8/15
to SpatiaLite Users

צחי יעקובוביץ

unread,
Oct 8, 2015, 4:57:13 PM10/8/15
to SpatiaLite Users
Thanks for the effort.
I tried changing the dll, but it did not work.
I suspect my problem is different.
  1.  I get a nice error message "A dynamic link library (DLL) initialization routine failed." while your description of the problem is a fault with hex address etc.
  2. sqlite3 loads mod_spatialite without a problem
Regards and Thanks again,
Tzahi



a.fu...@lqt.it

unread,
Oct 12, 2015, 1:36:16 PM10/12/15
to spatiali...@googlegroups.com
Hi Tzahi,

as it usually happens Language Connectors are proud to report
obscure and meaningless diagnostic messages when some failure
is encountered.
Python doesn't seems to be the expect ion to the rule:

> "A dynamic link library (DLL) initialization routine failed."
>

note: the name of the failing DLL is a secret mystery :-P

anyway, we can get few useful bits of information out of this:
1. sqlite do actually started the "load_extension" sequence;
well, so it's for sure a supported option.
2. mod_spatialite.dll was successfully located within the
system path; otherwise a "module not found" message (or
something like) should be reported.
3. anyway the DLL failed to correctly load.

AFAIK there are only two possible explanations for this:
a. the DLL depends on soma other DLL(s) and one of them
cannot be loaded: we can reasonably exclude this
hypothesis because sqlite3.exe successfully loads the
extension.
b. the DLL has the wrong addressing mode: i.e. an invalid
attempt was made by a 32 bit application to load a 64
bit DLL (or the opposite).
are you really sure that your Python exactly matches
the addressing mode of the DLLs ?

bye sandro


Jeremy Castagno

unread,
Jun 29, 2017, 8:35:33 PM6/29/17
to SpatiaLite Users
I also had this issue.  The solution to my problem was done by following this blogpost: http://blog.jrg.com.br/2016/04/25/Fixing-spatialite-loading-problem/

Simply needed to replace the libstdc++_64-6 with a more up to date one form mingw 64.  Now its working.   Hope this helps.

Majid Hojati

unread,
Oct 30, 2018, 9:29:34 AM10/30/18
to SpatiaLite Users
Hi,
Where did you get libstdc++_64-6 ? can you please share it?

a.fu...@lqt.it

unread,
Oct 30, 2018, 10:26:01 AM10/30/18
to spatiali...@googlegroups.com
On Tue, 30 Oct 2018 06:29:33 -0700 (PDT), Majid Hojati wrote:
> Hi,
> Where did you get libstdc++_64-6 ? can you please share it?
>

Majid,

libstdc++ is the c++ run time supporting executables
generated by MinGW, the well known open source compiler
for Windows.

so you simply have to download and install some recent
version of MinGW (32 or 64) in order to get this library.
the easiest way is by installing first the appropriate
user-friendly installer available from here:

http://www.msys2.org/

bye Sandro

p.s.: sharing at random DLL files coming from untrusted
sources surely is a very effective way for disseminating
viruses and other dangerous malware.
never ever think about something like; security first,
always !!!





Majid Hojati

unread,
Oct 30, 2018, 11:10:57 AM10/30/18
to SpatiaLite Users
Dear Sandro,
Thanks very much, I am downloading the link you provided. I'll report the results. thanks

Majid Hojati

unread,
Oct 30, 2018, 11:24:32 AM10/30/18
to SpatiaLite Users
Thanks it worked.


On Tuesday, October 30, 2018 at 5:56:01 PM UTC+3:30, sandro furieri wrote:
Reply all
Reply to author
Forward
0 new messages