1

I am trying to install PyInstaller and when I use pip install PyInstaller it doesn't work.

I also tried to download the ZIP and install the requirements with pip install -r requirements.txt but that didn't work either...

Collecting pyinstaller
  Using cached https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz
ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 178, in main
    status = self.run(options, args)
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\commands\install.py", line 352, in run
    resolver.resolve(requirement_set)
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\resolve.py", line 131, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\operations\prepare.py", line 362, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\operations\prepare.py", line 144, in prep_for_dist
    self.req.build_env = BuildEnvironment()
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\build_env.py", line 105, in __init__
    ).format(system_sites=system_sites, lib_dirs=self._lib_dirs))
  File "c:\users\Rom\appdata\local\programs\python\python37\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 148-150: character maps to <undefined>

I expected it to work even though it had one exception because when I try again it says that all of the requirements are satisfied :P

I am sorry it's so messy, I just really don't know what to do :'(

Vishnu Dasu
  • 533
  • 5
  • 18
rom_totach
  • 106
  • 8

3 Answers3

2

Since you're on Windows, try installing the PyInstaller wheel from Christoph Gohlke's website: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyinstaller

Unfortunately he has disabled linking directly to wheels on his website, so you have to physically go there and download the wheel yourself. You'll see a link to PyInstaller‑3.4‑py2.py3‑none‑any.whl when you visit the above link. Click on the link to download the wheel directly, then in the Command Prompt, navigate to where you downloaded it and do:

pip install PyInstaller‑3.4‑py2.py3‑none‑any.whl

This should get it installed!


Edit

It seems that the trouble you're facing once you install the package is a well-known one in Windows: https://github.com/pyinstaller/pyinstaller/issues/310

The solution is to insert this code at the beginning before you do anything:

import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout) 

It has something to do with the source code of PyInstaller where it's in an encoding scheme that is different on your machine from how it was originally developed.

rayryeng
  • 102,964
  • 22
  • 184
  • 193
  • now I have another problem. When I use the pyinstaller it gives me an exception: UnicodeEncodeError: 'charmap' codec can't encode characters in position 122-124: character maps to – rom_totach Jun 04 '19 at 08:07
  • @rom_totach Please see my edit. Apparently this is an issue with Windows. – rayryeng Jun 04 '19 at 08:11
  • that still didn't work... Do I need to add this part in every .py file? – rom_totach Jun 04 '19 at 08:31
  • I am using this in one file but this file uses a lot of methods in other files – rom_totach Jun 04 '19 at 08:33
  • And I have a lot of precompiled python files, I am using a bot library, so... probably something in the precompiled files – rom_totach Jun 04 '19 at 08:33
  • Ohhhhh no. Hmm - from what I read, you should only have to do this in the main entry file... – rayryeng Jun 04 '19 at 08:34
  • @rom_totach Found another solution: https://stackoverflow.com/questions/32382686/unicodeencodeerror-charmap-codec-cant-encode-character-u2010-character-m. The solution is to also do `chcp 65001` in the Command Prompt. – rayryeng Jun 04 '19 at 08:36
  • still not working :( maybe its bc my username on my pc is in Hebrew? I mean where Python is installed – rom_totach Jun 04 '19 at 08:42
  • Ohhhh - yes that could also be it. I'm out of ideas then. – rayryeng Jun 04 '19 at 08:43
0

pipwin installs unofficial python package binaries for windows provided by Christoph Gohlke here

pip install pipwin
pipwin install pyinstaller
Smart Manoj
  • 5,230
  • 4
  • 34
  • 59
0

To install PyInstaller:

  1. Go to your command prompt (Start -> Run -> cmd)
  2. type the following command cd c:\python27\scripts press enter, this should be where your pip.exe file is located.
  3. Once you are in this directory type pip install pyinstaller press enter

Message should read Successfully installed pyinstaller.

https://pyinstaller.readthedocs.io/en/v3.3.1/installation.html

PirrenCode
  • 444
  • 4
  • 14