Page 1 of 1

[Solved] ImportError: module does not define init function

Posted: Mon Nov 16, 2015 11:16 am
by ninjalf2
I followed the guide http://dev.deluge-torrent.org/wiki/Installing/Source to install deluge both with libtorrent built from source and with the rb_libtorrent* version 1.0.6 packages from CentOS's epel repo.

Both of them give me this error:

Code: Select all

[lasse@localhost ~]$ deluged -d
[ERROR   ] 12:03:04 main:237 dynamic module does not define init function (initlibtorrent)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/deluge-1.3.12-py2.7-linux-x86_64.egg/deluge/main.py", line 230, in start_daemon
    Daemon(options, args)
  File "/usr/lib64/python2.7/site-packages/deluge-1.3.12-py2.7-linux-x86_64.egg/deluge/core/daemon.py", line 136, in __init__
    from deluge.core.core import Core
  File "/usr/lib64/python2.7/site-packages/deluge-1.3.12-py2.7-linux-x86_64.egg/deluge/core/core.py", line 36, in <module>
    from deluge._libtorrent import lt
  File "/usr/lib64/python2.7/site-packages/deluge-1.3.12-py2.7-linux-x86_64.egg/deluge/_libtorrent.py", line 59, in <module>
    import libtorrent as lt
ImportError: dynamic module does not define init function (initlibtorrent)
I am running CentOS 7 x64 kernel 3.10.0-229.20.1.el7 and the python bindings seem to be installed as far as I can tell:

Code: Select all

[lasse@localhost ~]$ python -c "import libtorrent; print libtorrent.version"
1.0.6.0

[lasse@localhost ~]$ locate /usr/lib*/libtorrent*
/usr/lib64/libtorrent-rasterbar.so
/usr/lib64/libtorrent-rasterbar.so.8
/usr/lib64/libtorrent-rasterbar.so.8.0.0
The results of the above commands as well as the error are the same both with rb_libtorrent* EPEL packages and with libtorrent-rasterbar-1.0.7 built from source.

Also I don't understand why python says the version is 1.0.6.0 when I in fact built libtorrent-rasterbar-1.0.7. Did the author forget to update the version number or is it intentional?


Anyway.. What could be causing this error? So far I have seen only one person having the same error, namely this topic: http://forum.deluge-torrent.org/viewtop ... =7&t=27075 but it is not his inital problem but instead seems to occur after he fixes several other bugs/mistakes.


Thanks in advance and please let me know if you need more info

ninjalf2

Re: ImportError: dynamic module does not define init functio

Posted: Mon Nov 16, 2015 12:48 pm
by Cas
Did you build and install libtorrent before installing Deluge? How specifically did you build libtorrent? (Don't let Deluge build libtorrent, it's an old script)

That version mismatch is a mistake with building and/or installing. Did you run ldconfig?

Use updatedb and locate to remove all libtorrent references and start over with libtorrent 1.0.7 tarball then install Deluge.

Re: ImportError: dynamic module does not define init functio

Posted: Mon Nov 16, 2015 2:07 pm
by ninjalf2
I followed http://dev.deluge-torrent.org/wiki/Building/libtorrent step 2 to step 5 to the letter but it seems that wasn't the issue. Removing all libtorrent files and rebuilding did indeed do the trick. It now shows 1.0.7.0 and deluge runs fine (as far as I can tell, no errors on startup).

It seems the reason it showed 1.0.6.0 before was due to some old leftover libtorrent files.


Thank you, Cas, the issue is resolved. I don't know if I am supposed to mark it solved nor how to do it.


Best regards
ninjalf2