pyinstaller No module named pyinstaller
Asked Answered
I

18

38

I have 2 python versions installed under my mac osx sierra: python 3.5 python 2.7

I installed pyinstaller under python3.5 with this command:

python3.5 -m pip install pyinstaller

If I run again the same command I'm getting:

Requirement already satisfied: pyinstaller in ./lib/python3.5/site-packages Requirement already satisfied: setuptools in ./lib/python3.5/site-packages (from pyinstaller)

That to me means that is is installed under python 3.5 and ready to be used.

When I run this command:

python3.5 -m pyinstaller mypython35script.py

I'm getting: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5: No module named pyinstaller

Why? What I'm doing wrong?

Isidraisidro answered 24/6, 2017 at 20:38 Comment(3)
Have you tried just pyinstaller mypython35script.py?Hapte
yes but isn't working for me because if I do this it works using python2.7 not the 3.5 version that I need to run.Isidraisidro
maybe remove Python3.5 from the PATH and then once you're done with pyinstaller, add it back? Just a thoughtInsignificancy
H
103

Their package name have caps in it (not sure if it's very PEP8 tho..). This should work if you can't find the pyinstaller executable script:

python -m PyInstaller your_script.py 
Higbee answered 19/1, 2018 at 9:34 Comment(4)
This sounds funny but Today I was using using PyInstaller but forgot about it's correct import name and spend 20 minutes to figure it out then when finally I came here and saw my upvote. So Thankyou again @GuillaumeMattress
This overwrites the specfilePrissie
wasted 3 hours on this error, thanks!!Valid
this was my case, thank you.Vitiated
B
45

I had same issue here, and i tried everything, but finally i found the solution :

enter image description here

I had to downgrade pip from version 19 to 18.1 :

pip install pip==18.1

Then install PyInstaller :

pip install pyinstaller

.

As you see i managed to install it : enter image description here .

After that you can upgrade your pip again :

python -m pip install --upgrade pip
Balanced answered 24/1, 2019 at 2:44 Comment(2)
@Paolo i tried everything to fix it, and this is the only thing that worked for me.Balanced
Fine, for this reason accept (sorry I said "check") your answer. To mark an answer as accepted, click on the check mark beside the answer to toggle it from greyed out to filled in (green). For StackOverflow stats it means one more successful answer on the platform.Kevinkevina
S
9

PyInstaller is case sensitive when being executed from the python3 - m method. You need to run it as follows.


python3 -m PyInstaller yourscript.py


If you want directly execute from the terminal you need to install it as follows.


python3 -m pip install pyinstaller or pip3 install pyinstaller


Following that, you need to set your global python executable to python3.


pyinstaller yourscript.py


Stuppy answered 1/4, 2020 at 0:49 Comment(1)
I had this error with the recommended syntax (pyinstaller your_program.py), but specifying python3 as suggested above solved the problem. (I'm in Windows 10).Declared
M
3

I had the same trouble, so I tried to do as @mounirboulwafa says.

I had to downgrade pip from version 19 to 18.1 :
pip install pip==18.1

But I got this error again even during pip 18 install!

So I readed console logs again and saw some lines about user, permission etc. And tried to start cmd as admin, and repeat install pyinstaller.

It works!

So typical thing surprisely resolved the sitation. Hope it helps somebody.

Matteroffact answered 3/2, 2019 at 4:15 Comment(0)
S
2

In my case I just opened cmd in Admin mode and re-ran the below cmd and it worked.

pip install pyinstaller

Size answered 4/2, 2019 at 13:8 Comment(1)
I do believe anyone running into the error above while trying to install pyinstaller via "pip install pyinstaller" ought to uninstall first and then open cmd and install again - worked like a charm!Resonator
R
2

Finally, this version drops support for Python 2.7, which is end-of-life since January 2020.. The minimum required version is now Python 3.5. The last version supporting Python 2.7 was PyInstaller 3.6.

pip install pyinstaller==3.6

So if anybody using python 2.7 version, Just install pyinstaller3.6 version and run it will work fine.

Repairman answered 30/11, 2020 at 16:7 Comment(0)
T
2

You need to go to the file that your .py is, and pyinstaller need to be capitalized like this "PyInstaller"

Full command: python -m PyInstaller --onefile [yourfile.py]

Put -w behind the --onefile if you want on console file

Tsai answered 24/10, 2021 at 8:13 Comment(0)
S
1

You should navigate into your scripts folder and open command window there (by clicking right mouse button while holding down shift key) and write in there:

pyinstaller mypython35script.py

If the script is in another location drag your script into the command window after typing pyinstaller. Hope this helps.

Splotch answered 24/6, 2017 at 21:23 Comment(2)
If I run that command is going to pick up the default OSX python version that I don't / can't use.Isidraisidro
For python 2.7 you must be having a folder such as Python27. But for Python 3.5 you may be having a folder like Python35 (or Python35-32). In that folder you will find similar contents. Find in there the script folder then do the necessary operations. Nevertheless, if the exe is created once it doesn't really concern which python version it was used to make (as long as the dist folder is not messed up with)Splotch
I
1

Right now the only way I found to make it works is to: navigate to:

/Library/Frameworks/Python.framework/Versions/3.5/bin

run pyinstaller mypython35script.py

cheers d.

ps I still don't know why is not working in the way I described in my first post.

Isidraisidro answered 24/6, 2017 at 22:41 Comment(1)
In you question you mentioned the error as No module named pyinstaller which is because the pyinstaller module was not installed for the python 3.5 version.Splotch
B
1

Rename your pyinstaller to pyinstaller35 and also rename your pyinstaller-script.py to pyinstaller35-script.py inside the scripts directory which is inside the python3.5 installation directory. Now add the scripts directory to the system path. Now you can run it as pyinstaller35 yourfile.py -F

Botany answered 7/2, 2018 at 6:8 Comment(0)
N
1

From Anaconda prompt the following works for me. Run the following command after navigating to the location of the module

pyinstaller --onefile mypython35script.py
Natalee answered 10/4, 2018 at 14:10 Comment(0)
L
1

This works in my case with pip version 19.0.1

cmd => rightclick => with admin rights

Enter in cmd: "pip install pyinstaller"
Lugworm answered 7/2, 2019 at 10:24 Comment(0)
L
1

PyInstaller having issues with pip 19.0 (https://github.com/pyinstaller/pyinstaller/issues/4003)

Downgrade pip to 18.1 version works fine.

Louralourdes answered 26/11, 2019 at 16:1 Comment(0)
R
1

I had the same problem, turns out module names are CASE-SENSITIVE which I didn't know, so instead of cmd -

python3.5 -m pyinstaller mypython35script.py

you're supposed to run

python3.5 -m PyInstaller mypython35script.py

Turns out there was no issue with Installation as it showed

Requirement already satisfied: pyinstaller in ./lib/python3.5/site-packages Requirement already satisfied: setuptools in ./lib/python3.5/site-packages (from pyinstaller)

pip install searches for the module name in PyPi (Python Package Index) where case doesn't matter

Please feel free to correct me or add comments as I am fairly new to Python and command line

Rosalia answered 22/3, 2020 at 12:15 Comment(0)
K
1

None of the solutions have worked for me so i tried to uninstall pyinstaller via the command

py -m pip uninstall pyinstaller

The last path they gave was a path to the script "pyinstaller.exe". So all I did was drag and drop and it worked!

Khalid answered 22/11, 2020 at 12:41 Comment(0)
B
0

After some research as of 12/20/2022 it seems to be not supported for my py version 3.10

Python: 3.7-3.11. Note that Python 3.10.0 contains a bug making it unsupportable by PyInstaller. PyInstaller will also not work with beta releases of Python 3.12. https://github.com/pyinstaller/pyinstaller

Becka answered 21/12, 2022 at 0:58 Comment(0)
C
0

Just downgrade your python version and try it again. This will work, if not just download python3.8 and give it a try.

Conformation answered 18/5, 2023 at 5:25 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Vehicular
C
0

If you are on windows and using a python installation from the windows store, you might a warning from pip when installing that the directory ending in

LocalCache\local-packages\Python310\Scripts

is not on the Path.

I just added this directory to my Path (Control Panel > Edit the system environment variables) and I could then call pyinstaller directly from the command line.

Clueless answered 8/1, 2024 at 14:13 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.