[Rpm-maint] Python bindings: ModuleNotFoundError on custom prefix
Panu Matilainen
pmatilai at redhat.com
Tue Sep 12 06:59:10 UTC 2017
On 09/11/2017 06:31 PM, Jun Aruga wrote:
> Hello,
>
> Though it might be basic thing,
> when I built latest master branch's source with ./configure --prefix,
> then I did import the Python bindings, I got ModuleNotFoundError.
>
> Could you tell me how to import it?
Um, "import rpm"?
If that doesn't work then either it's not in your runtime environment
paths, or there's something wrong with the build.
> Thanks.
>
>
> Below steps are what I did.
>
> $ pwd
> /home/jaruga/git/rpm
>
> $ ./autogen.sh --noconfigure
>
> $ ./configure --prefix="$(pwd)/dest"
>
> $ make
>
> $ make install
>
> $ ls dest/
> bin/ include/ lib/ share/ var/
>
> $ cd python/
>
> $ python3 -m venv ./venv
No idea what this does so hard to say.
>
> (venv) $ python setup.py build
>
> (venv) $ python setup.py install
>
> (venv) $ pip list
> Package Version
> ---------- -------
> pip 9.0.1
> rpm 4.14.90
> setuptools 28.8.0
>
> (venv) $ python -c 'import rpm'
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/home/jaruga/git/rpm/python/rpm/__init__.py", line 38, in <module>
> from rpm._rpm import *
> ModuleNotFoundError: No module named 'rpm._rpm'
>
> (venv) $ python -c 'import sys; print(sys.path)'
> ['', '/usr/local/python-3.6.1/lib/python36.zip',
> '/usr/local/python-3.6.1/lib/python3.6',
> '/usr/local/python-3.6.1/lib/python3.6/lib-dynload',
> '/home/jaruga/git/rpm/python/venv/lib/python3.6/site-packages']
>
> (venv) $ ls venv/lib/python3.6/site-packages/rpm/ | sort
> __pycache__/
> _rpm.cpython-36m-x86_64-linux-gnu.so
> <http://rpm.cpython-36m-x86_64-linux-gnu.so>*
> _rpmb.cpython-36m-x86_64-linux-gnu.so
> <http://rpmb.cpython-36m-x86_64-linux-gnu.so>*
> _rpms.cpython-36m-x86_64-linux-gnu.so
> <http://rpms.cpython-36m-x86_64-linux-gnu.so>*
> __init__.py
> transaction.py
Maybe it can't find the libraries of the newer rpm? strace is your
friend, see what it's actually trying to do.
There's also https://github.com/rpm-software-management/rpm/issues/130
which might affect things but not sure that would manifest in this way.
- Panu -
More information about the Rpm-maint
mailing list