pythoninstallationpippyinstallerspyder

No module named 'pyinstaller'


I want to create an installer for my app but when I tried to run my code I had an error that says that there is no module 'pyinstaller' even if I have this module installed.

This import causes an error in my program:

import pyinstaller.__main__

I am using spyder to run python-3.8.5 but when I run my code it show me this error message:

runfile('C:/Users/Documents/CalculBride/PyInstaller.py',
wdir='C:/Users/Documents/CalculBride')
Traceback (most recent call last):

  File "C:\Users\Documents\CalculBride\PyInstaller.py", line 1, in <module>
    import pyinstaller.__main__

ModuleNotFoundError: No module named 'pyinstaller'

I checked with the pip list command, in the spyder console and I had pyinstaller-6.9.0 installed So I uninstall pyinstaller and install it back again (pyinstaller 6.9.0). Still the same No module named 'pyinstaller'. So I discussed with someone who could run my code on pyinstaller 3.6 and I tried to install this version of pyinstaller but I had this error message: Error_PyInstaller_3-6

So i try to upgrade pip and i had this error: Error_pip

I am wondering if it is due to fact I previously installed auto-py-to-exe (which uses pyinstaller) but even after I uninstalled auto-py-to-exe there is still this no module named 'pyinstaller' error, even if I can see that this module is installed when i do a pip list in the spyder console.


Solution

  • About the ModuleNotFoundError:

    It should be import PyInstaller.__main__ not import pyinstaller.__main__. Notice it's upper case. See the documentation.


    About the installation of PyInstaller 3.6:

    From the PyInstaller pypi, you will know that PyInstaller 3.6 doesn't work with Python 3.8. It starts to support Python 3.8 from version 4.1. So you can try pip install pyinstaller==4.1.

    PyInstaller 3.6 pypi