[Python] Why do I get "No module named 'construct'" when installing PyKeePass?

Discussão em 'Python' iniciado por Stack, Julho 26, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to install the PyKeePass library in my Python environment. I successfully installed all other pip libraries I need but can't install this one. Python version is 3.7.9. I navigate to the folder Python is installed in and run python -m pip install pykeepass which was working in my previous environment. The output (I cleared some locations and names):

    Collecting pykeepass
    Using cached pykeepass-4.0.1.tar.gz (48 kB)
    Preparing metadata (setup.py) ... done
    Requirement already satisfied: python-dateutil in ..\python\lib\site-packages (from pykeepass) (2.8.1)
    Collecting construct==2.10.54
    Using cached construct-2.10.54.tar.gz (55 kB)
    Preparing metadata (setup.py) ... error
    error: subprocess-exited-with-error

    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [6 lines of output]
    Traceback (most recent call last):
    File "<string>", line 36, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "..\AppData\Local\Temp\2\pip-install-v1_9y764\construct_xxxxxxxxxxxxxxxxxxxxxxxx\setup.py", line 3, in <module>
    from construct.version import version_string
    ModuleNotFoundError: No module named 'construct'
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.


    When I try to install the construct I end up with the same error:


    ModuleNotFoundError: No module named 'construct'
    ​

    Continue reading...

Compartilhe esta Página