Someguy123
Someguy123

Reputation: 1352

Py2Exe "The following modules are missing"

When using Py2Exe, I get a warning such as

The following modules appear to be missing
['Crypto', 'Crypto.Cipher', 'Crypto.Hash', 'Padding']

The resulting EXE errors because it cannot find those modules. I can see they are in my site-packages, so why is it not detecting them?

Note: Crypto and Padding were installed through pip/easy_install

Upvotes: 2

Views: 4973

Answers (1)

Someguy123
Someguy123

Reputation: 1352

First, check if your packages are in .EGG format

It appears Py2Exe has problems with Python's .egg packages. By extracting the .egg files (rename to .zip and extract into site-packages excluding EGG-INFO folder), Py2Exe can now detect those packages without issues.

Check your setup.py to make sure you're using the right option. Windowed applications use "windows=" where-as console applications use "console="

In some other cases it could be through the use of setup(console=['main.py']) instead of setup(windows=['main.py']) if you're producing a windowed application.

If it's still not working, you can try telling Py2Exe to manually include the package

Some packages can further be resolved by adding them to the package options of your setup.py like this:

setup(
    windows=['main.py'],
    options={
            "py2exe":{
                    "packages": ["Crypto", "Padding"]
            }
    }

Upvotes: 4

Related Questions