On Fri, 22 Jul 2011, Tom Hendrikx wrote:
ImportError: No module named unboundmodule
After some debugging I realised that unbound is unable to find the
unboundmodule.py file that is placed in
/usr/lib64/python2.7/site-packages. I was able to temporarily resolve
this by adding a symlink to the python file in /etc/unbound/, but this
is of course a hack.
Since the file is placed in /usr/lib64/python2.7/site-packages/ by the
Makefile, it looks as if there is no special adaption done by the distro
package. This is why I am asking my question here first ;)
Thanks for reporting this.
I can confirm this problem is present in the fedora/rhel/centos package.
Though for me, on x86_64 it is placed in:
/usr/lib/python2.7/site-packages/unboundmodule.py
I can confirm linking it in /etc/unbound resolves this.
I changed the %configure from using --with-pythonmodule to use:
--with-pythonmodule=%{python_sitearch}
which expands to:
--with-pythonmodule=/usr/lib64/python2.7/site-packages
but it seems unbound still places the files in the wrong location when
running "make install" and places the sitearch files in the sitelib
directory
Makefile.inc shows:
$(INSTALL) -c -m 644 pythonmod/unboundmodule.py
$(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
PYTHON_SITE_PKG is set to:
python -c "import distutils.sysconfig; print
distutils.sysconfig.get_python_lib(0,0);"
/usr/lib/python2.7/site-packages
However, the unbound daemon does not seem to look there......
Note that /usr/lib/python2.7/site-packages/_unbound.so.2.12.0 also seems to be
in the 32 instead of
the 64 bit location....
A grep shows me :
[paul@bofh unbound-1.4.12rc1]$ grep get_python_lib *
acx_python.m4: print '-L' + get_python_lib(0,1), \
acx_python.m4: '-L' +
os.path.dirname(get_python_lib(0,1)), \
acx_python.m4: print
distutils.sysconfig.get_python_lib(0,0);"`
configure: print '-L' + get_python_lib(0,1), \
configure: '-L' + os.path.dirname(get_python_lib(0,1)), \
configure: print distutils.sysconfig.get_python_lib(0,0);
The first argument to get_python_lib is a boolean for plat_specific=
If I change that to 1, then it seems the files are installed in their
right locations:
[root@bofh unbound]# rpm -ql unbound-python
/usr/lib64/python2.7/site-packages/_unbound.so
/usr/lib64/python2.7/site-packages/_unbound.so.2
/usr/lib64/python2.7/site-packages/_unbound.so.2.12.0
/usr/lib64/python2.7/site-packages/unbound.py
/usr/lib64/python2.7/site-packages/unbound.pyc
/usr/lib64/python2.7/site-packages/unbound.pyo
/usr/lib64/python2.7/site-packages/unboundmodule.py
/usr/lib64/python2.7/site-packages/unboundmodule.pyc
/usr/lib64/python2.7/site-packages/unboundmodule.pyo
but it seems the python module still fails to initialise:
Jul 21 22:59:47 libunbound[846:0] notice: init module 1: python
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named unboundmodule
Jul 21 22:59:47 libunbound[846:0] error: pythonmod: cannot initialize core
module: unboundmodule.py
Jul 21 22:59:47 libunbound[846:0] error: module init for module python failed
resolve error: initialization failure
The search path in strace of unbound-host shows:
[root@bofh unbound]# grep unboundmodule out
stat("/usr/lib64/python2.7/unboundmodule", 0x7fff16839290) = -1 ENOENT (No such
file or directory)
open("/usr/lib64/python2.7/unboundmodule.so", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/lib64/python2.7/unboundmodulemodule.so", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/lib64/python2.7/unboundmodule.py", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/lib64/python2.7/unboundmodule.pyc", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat("/usr/lib64/python2.7/plat-linux2/unboundmodule", 0x7fff16839290) = -1
ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/unboundmodule.so", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/unboundmodulemodule.so", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/unboundmodule.py", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/unboundmodule.pyc", O_RDONLY) = -1
ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/lib-dynload/unboundmodule", 0x7fff16839290) = -1
ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/unboundmodule.so", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/unboundmodulemodule.so", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/unboundmodule.py", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/unboundmodule.pyc", O_RDONLY) = -1
ENOENT (No such file or directory)
stat("./unboundmodule", 0x7fff16839290) = -1 ENOENT (No such file or directory)
open("./unboundmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./unboundmodulemodule.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("./unboundmodule.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./unboundmodule.pyc", O_RDONLY) = -1 ENOENT (No such file or di
and then finally /etc/unbound/
I'm not sure yet why it is not searching in /usr/lib64/python2.7/site-packages/
first
I also think that the value for --with-pythonmodule seems to be lost during
make install
Paul
_______________________________________________
Unbound-users mailing list
[email protected]
http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users