Fix PyInstaller cannot Check for Assembly Dependencies After Having Installed pywin32-ctypes

By | December 9, 2019

Python pyinstaller is a good tool to bundle python scripts to exe application. However, you may find error: PyInstaller cannot check for assembly dependencies. Please install pywin32-ctypes when you are running. In this tutorial, we will tell you how to fix it.

Here is an example:

We use pyinstaller to bundle a python application like:

pyinstaller -i png2eps.ico -F -n PNG2EPS

Then we will get error:

PyInstaller cannot check for assembly dependencies. Please install pywin32-ctypes

Then we need to install pywin32-ctypes.

Install pywin32-ctypes

We use pip to install this package like this:

pip install pywin32-ctypes

After installing pywin32-ctypes, we can start to bundle python scripts.

Bundle a python application

We use pyinstaller bundle python application again, however, this error is still existing.

pyinstaller need pywin32-ctypes error

How to fix this error?

In this tutorial, we will introduce you how to fix this error, you can do by our steps.

Check you have installed pywintypes and win32api

As to us, we have installed them, however, we have not installed win32ctypes.pywin32.

import pywintypes
import win32api
from win32ctypes.pywin32 import pywintypes

Here is our result.

pyinstaller import win32ctypes

Open pyinstaller file

You should find pyinstaller file and open it.

open pyinstaller file

Pyinstaller changesĀ  win32ctypes

You may find code below in

from win32ctypes.pywin32 import pywintypes  # noqa: F401
from win32ctypes.pywin32 import win32api

Change codes to:

import pywintypes  # noqa: F401
import win32api

Here is an example.

pyintallder change win32ctypes

Save and bundle python scripts again.

Bundle python script again

We bundled python scripts again and we find it is bundled successfully.

pyinstaller build python to exe sucessfully

Which means this error is fixed.