Meson cannot find pykeepass module, I am certain it is installed
Asked Answered
O

1

7

I am attempting to build an application using meson, Gnome PasswordSafe. I have successfully built it on Arch, but have since moved to PureOS (Debian).

When running:

 $ meson . _build --prefix=/usr

it tells me:

meson.build:36:4: ERROR: Problem encountered: Missing dependency pykeepass >= master

What am I missing?

Thanks!


I installed pykeepass using pip. When that did not work, I tried using pip3. When that did not work, I tried both again, but with sudo. Still no dice.

I then installed it from the repo/source (https://github.com/pschmitt/pykeepass). No dice.


Currently, python help recognizes pykeepass as being installed to:

/home/dc3p/.local/lib/python3.7/site-packages/pykeepass/__init__.py
/usr/local/lib/python3.7/dist-packages/pykeepass/__init__.py
/home/dc3p/.local/lib/python2.7/site-packages/pykeepass/__init__.py
/usr/local/lib/python2.7/dist-packages/pykeepass/__init__.py

pip and pip3 list shows pykeepass as being present.

While I have it installed in all four locations currently, I have also tried while having only one installed at any location at a time.

I have also tried the meson command without and with sudo. Regardless of what I do, meson throws the same error.

Expected result is a build.

Oira answered 1/8, 2019 at 19:59 Comment(6)
Is dc3p some kind of virtual env which you are using? And have you checked python is added to the path?Tucky
Moreover it seems you have python installed at two different locations? So it could happen due to conflict it is not able to detect the pykeepass libTucky
I don't know much of meson, but you must check what's the python it's using and make pykeepass available there, is not through a virtual environment, then with the --user option (pip.pypa.io/en/stable/reference/pip_install/#cmdoption-user) or with the --root option (pip.pypa.io/en/stable/reference/pip_install/#cmdoption-root)Curst
BTW, prefer python 3.x as 2.7 will STOP being officially supported by 2020 (python.org/dev/peps/pep-0373)Curst
From the documentation: "Due to our frequent release cycle and development speed, distro packaged software may quickly become outdated." Have you tried installing meson from pip? Arch is fast at updating packages as opposed to Debian which prefers stability to cutting edge software. Link to the docZela
What happens if you don't use --prefix=/usr?Sami
Z
1

The meson.build file in PasswordSafe is testing for the presence of a directory in the file system which can lead to false negatives if the installation directory varies. See the code extract below.

# Python Module Check
pykeepass_dir = join_paths(python_dir, 'pykeepass')
construct_dir = join_paths(python_dir, 'construct')

if run_command('[', '-d', pykeepass_dir, ']').returncode() != 0
    error('Missing dependency pykeepass >= master')
endif

if run_command('[', '-d', construct_dir, ']').returncode() != 0
    error('Missing dependency python-construct >= 2.9.45')
endif

You can replace the above with the following to test for dependencies based on imports:

python3_required_modules = ['pykeepass', 'construct']

foreach p : python3_required_modules
    script = 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\''+ p +'\') is None else exit(0)'
    if run_command(python_bin, '-c', script).returncode() != 0
        error('Required Python3 module \'' + p + '\' not found')
    endif
endforeach

This should solve the issue providing that pykeepass is within your path.

Zela answered 27/2, 2020 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.