Error with non-ASCII character? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Error with non-ASCII character? (/thread-30812.html) Pages:
1
2
|
Error with non-ASCII character? - giomach - Nov-07-2020 Using 3.9.0 under Windows 10. I get an error with "pip install pyinstaller" as below (my username REDACTED in this excerpt): ---- C:\Users\REDACTED>pip install pyinstaller Collecting pyinstaller Downloading pyinstaller-4.0.tar.gz (3.5 MB) |████████████████████████████████| 3.5 MB 2.2 MB/s Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... error ERROR: Command errored out with exit status 1: command: 'c:\users\REDACTED\appdata\local\programs\python\python39\python.exe' 'c:\users\REDACTED\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\CIARND~1\AppData\Local\Temp\tmp6k9s7407' cwd: C:\Users\REDACTED\AppData\Local\Temp\pip-install-67epkggr\pyinstaller Complete output (38 lines): Error in sitecustomize; set PYTHONVERBOSE for traceback: SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data (sitecustomize.py, line 7) ---- I suspect this is due to my username containing non-ASCII characters. The first such character in the username is "á", which in ANSI is 0xe1, and it looks like this is being treated as utf-8, where it would indeed be an error. (Elsewhere in this log, you see the username converted to Windows 8+3 form, but where I have redacted it, it appeared in full.) Is there some setting to avoid this problem? Thanks. RE: Error with non-ASCII character? - snippsat - Nov-07-2020 There is no official support for 3.9 yet. pyinstaller Wrote:Requirements and Tested PlatformsTry developer version will have earliest support for 3.9 pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz RE: Error with non-ASCII character? - giomach - Nov-07-2020 Thanks, but I still get the same error. The problem must be at the interface between python and Windows. I have already (in a very short python programming career) encountered it in several different situations. It would seem that Windows encodes usernames in the local 8-bit codepage, which for me is ANSI alias CP1252, whereas python interprets them (in some situations, including this one) as being in utf8 — or perhaps vice versa. Thanks for any further ideas. RE: Error with non-ASCII character? - snippsat - Nov-07-2020 (Nov-07-2020, 05:45 PM)giomach Wrote:Have you made this sitecustomize.py yourself)It's not a part of original file as least in Python 3.8,has not 3.9 yet. This is a file i have made myself in the past look at this post. Dos other pip install works?pip install requestsCan try to run a virtual environment(build into Python),this is was i always do if help someone with Pyinstaller,to get all new installation. A demo i use cmder(recommend),commnad is just the same in cmd .# Test python E:\div_code λ python -V Python 3.8.3 # Test pip E:\div_code λ pip -V pip 20.2.3 from c:\python38\lib\site-packages\pip (python 3.8) # Make environment E:\div_code λ python -m venv my_env # cd in E:\div_code λ cd my_env\ # Activate, see (my_env) E:\div_code\my_env λ E:\div_code\my_env\Scripts\activate # Test pip again,now point to this folder (my_env) E:\div_code\my_env λ pip -V pip 19.2.3 from e:\div_code\my_env\lib\site-packages\pip (python 3.8) # Install (my_env) E:\div_code\my_env λ pip install pyinstaller Collecting pyinstaller Downloading ..... Successfully installed altgraph-0.17 future-0.18.2 pefile-2019.4.18 pyinstaller-4.0 pyinstaller-hooks-contrib-2020.10 pywin32-ctypes-0.2.0 # Move python file this folder and run Pyinstaller (my_env) E:\div_code\my_env RE: Error with non-ASCII character? - giomach - Nov-07-2020 (Nov-07-2020, 07:42 PM)snippsat Wrote:Quote:SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data (sitecustomize.py, line 7)Have you made this sitecustomize.py yourself) No, I'm only starting out on python, I wouldn't know how or why to do that. I've checked my filesystem, and there is no such file as "sitecustomize.py". Perhaps it is temporary, created and deleted during the failed attempt to install pyinstaller. (Nov-07-2020, 07:42 PM)snippsat Wrote: Dos other pip install works? Yes, I've done several, or rather, I've done "py -m pip install", which gives the same error here. ---- C:\Users\REDACTED>pip install requests Requirement already satisfied: requests in c:\users\REDACTED\appdata\local\programs\python\python39\lib\site-packages (2.24.0) Requirement already satisfied: certifi>=2017.4.17 in c:\users\REDACTED\appdata\local\programs\python\python39\lib\site-packages (from requests) (2020.6.20) Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\REDACTED\appdata\local\programs\python\python39\lib\site-packages (from requests) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\REDACTED\appdata\local\programs\python\python39\lib\site-packages (from requests) (1.25.11) Requirement already satisfied: idna<3,>=2.5 in c:\users\REDACTED\appdata\local\programs\python\python39\lib\site-packages (from requests) (2.10) ---- (Nov-07-2020, 07:42 PM)snippsat Wrote: Can try to run a virtual environment(build into Python),this is was i always do if help someone with Pyinstaller,to get all new installation. Thanks, I appreciate your help, but I can't get involved in such complications, so I think I must make do without pyinstaller. I still suspect that the problem is the accented characters in my Windows username and hence in the name of my Windows home folder. These characters are differently encoded in ANSI and in utf-8 and this may not have been taken into account somewhere in python (not necessarily in pyinstaller). Any attempt to utf8-decode data which is actually in ANSI is bound to fail in exactly the way the error message describes. RE: Error with non-ASCII character? - snippsat - Nov-08-2020 (Nov-07-2020, 11:00 PM)giomach Wrote: Thanks, I appreciate your help, but I can't get involved in such complications, so I think I must make do without pyinstaller.It's not an complication virtual environment is used all time in Python,it just takes just some minute to do. (Nov-07-2020, 11:00 PM)giomach Wrote: I still suspect that the problem is the accented characters in my Windows username and hence in the name of my Windows home folder.With virtual environment you get a new path without username,then you can test if your suspicion is right. RE: Error with non-ASCII character? - giomach - Nov-08-2020 I tried the virtual environment but the result is still the same. Here's the whole output. The highlighting is not significant. Remember that REDACTED stands for my Windows username, which contains the character á (0xe1 in ANSI). Microsoft Windows [Version 10.0.19041.572] (c) 2020 Microsoft Corporation. All rights reserved. C:\Users\REDACTED>cd c:\tempenv c:\tempenv>python -V Python 3.9.0 c:\tempenv>pip -V pip 20.2.3 from c:\users\redacted\appdata\local\programs\python\python39\lib\site-packages\pip (python 3.9) c:\tempenv>python -m venv tempenv c:\tempenv>cd tempenv c:\tempenv\tempenv>c:\tempenv\tempenv\scripts\activate (tempenv) c:\tempenv\tempenv>pip -V pip 20.2.3 from c:\tempenv\tempenv\lib\site-packages\pip (python 3.9) (tempenv) c:\tempenv\tempenv>pip install pyinstaller Collecting pyinstaller Using cached pyinstaller-4.0.tar.gz (3.5 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... error ERROR: Command errored out with exit status 1: command: 'c:\tempenv\tempenv\scripts\python.exe' 'c:\tempenv\tempenv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\CIARND~1\AppData\Local\Temp\tmpdci12139' cwd: C:\Users\REDACTED\AppData\Local\Temp\pip-install-egc1g39g\pyinstaller Complete output (38 lines): Error in sitecustomize; set PYTHONVERBOSE for traceback: SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data (sitecustomize.py, line 21) running dist_info creating C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info writing C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\PKG-INFO writing dependency_links to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\dependency_links.txt writing entry points to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\entry_points.txt writing requirements to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\requires.txt writing top-level names to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\top_level.txt writing manifest file 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\SOURCES.txt' reading manifest file 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'pyinstaller-gui.py' no previously-included directories found matching 'bootloader\build' no previously-included directories found matching 'bootloader\.waf-*' no previously-included directories found matching 'bootloader\.waf3-*' no previously-included directories found matching 'bootloader\waf-*' no previously-included directories found matching 'bootloader\waf3-*' no previously-included directories found matching 'bootloader\_sdks' no previously-included directories found matching 'bootloader\.vagrant' warning: no previously-included files found matching 'bootloader\.lock-waf*' no previously-included directories found matching 'doc\source' no previously-included directories found matching 'doc\_build' warning: no previously-included files matching '*.tmp' found under directory 'doc' warning: no files found matching 'news\_template.rst' no previously-included directories found matching 'news' no previously-included directories found matching 'old' no previously-included directories found matching 'scripts' no previously-included directories found matching 'tests\scripts' no previously-included directories found matching '.github' warning: no previously-included files found matching '.*' warning: no previously-included files found matching '*.yml' warning: no previously-included files found matching '*~' warning: no previously-included files found matching '.directory' warning: no previously-included files matching '*.py[co]' found anywhere in distribution writing manifest file 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.egg-info\SOURCES.txt' creating 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-1n7dv1ne\pyinstaller.dist-info' error: invalid command 'bdist_wheel' ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\tempenv\tempenv\scripts\python.exe' 'c:\tempenv\tempenv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\CIARND~1\AppData\Local\Temp\tmpdci12139' Check the logs for full command output. WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available. You should consider upgrading via the 'c:\tempenv\tempenv\scripts\python.exe -m pip install --upgrade pip' command. (tempenv) c:\tempenv\tempenv> RE: Error with non-ASCII character? - snippsat - Nov-08-2020 Quick test taking down 3.9(64-version) from python.org,and install Pyinstaller. C:\Python39 λ cd Scripts\ # Test pip C:\Python39\Scripts λ pip -V pip 20.2.3 from c:\python39\lib\site-packages\pip (python 3.9) # Install C:\Python39\Scripts λ pip install pyinstaller Collecting pyinstaller Using cached pyinstaller-4.0.tar.gz (3.5 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Collecting pefile>=2017.8.1; sys_platform == "win32" Using cached pefile-2019.4.18.tar.gz (62 kB) Collecting altgraph Using cached altgraph-0.17-py2.py3-none-any.whl (21 kB) Requirement already satisfied: setuptools in c:\python39\lib\site-packages (from pyinstaller) (49.2.1) Collecting pywin32-ctypes>=0.2.0; sys_platform == "win32" Using cached pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB) Collecting pyinstaller-hooks-contrib>=2020.6 Using cached pyinstaller_hooks_contrib-2020.10-py2.py3-none-any.whl (166 kB) Collecting future Using cached future-0.18.2.tar.gz (829 kB) Using legacy 'setup.py install' for pefile, since package 'wheel' is not installed. Using legacy 'setup.py install' for future, since package 'wheel' is not installed. Building wheels for collected packages: pyinstaller Building wheel for pyinstaller (PEP 517) ... done Created wheel for pyinstaller: filename=pyinstaller-4.0-py3-none-any.whl size=2789243 sha256=daf919813c3480e195c2128eb8acd2a6d3e1a50bbd85255030ebbadce2a78ae7 Stored in directory: c:\users\tom\appdata\local\pip\cache\wheels\2a\50\fe\f2c2a71fc0d2ab3fb7f1ca281fc8cf50c2370d03923179863b Successfully built pyinstaller Installing collected packages: future, pefile, altgraph, pywin32-ctypes, pyinstaller-hooks-contrib, pyinstaller Running setup.py install for future ... done Running setup.py install for pefile ... done Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed altgraph-0.17 future-0.18.2 pefile-2019.4.18 pyinstaller-4.0 pyinstaller-hooks-contrib-2020.10 pywin32-ctypes-0.2.0 # Test that get no errors C:\Python39\Scripts λ pyinstaller --version 4.0As you see it work for me. I have no other idea now than uninstall and when install again choose a simpler Path(no OS username).As you see i choose C:\python39 Look at Python 3.8 (3.6-3.7) and pip installation under Windows It's the same for 3.9,you go into customize installation and choose Path wanted.Also run installation as admin(right click on file),and mark on install for all users to avoid permission Issus.
RE: Error with non-ASCII character? - giomach - Nov-08-2020 Python reinstalled to C:\Program Files\Python39 (which is where I want it anyway), everything done as administrator, installed for all users, added to PATH. But same error again in installing pyinstaller. REDACTED below replaces my Windows username, which contains the character á (0xe1 in ANSI), which is being misinterpreted as being in utf8 instead of ANSI, whence error. Please ignore highlighting. There is no sitecustomize.py in my file system. Microsoft Windows [Version 10.0.19041.572] (c) 2020 Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>python Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> exit() C:\WINDOWS\system32>python -V Python 3.9.0 C:\WINDOWS\system32>py -m pip install --upgrade pip Requirement already up-to-date: pip in c:\program files\python39\lib\site-packages (20.2.4) C:\WINDOWS\system32>py -m pip install pyinstaller Collecting pyinstaller Using cached pyinstaller-4.0.tar.gz (3.5 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... error ERROR: Command errored out with exit status 1: command: 'C:\Program Files\Python39\python.exe' 'C:\Program Files\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\CIARND~1\AppData\Local\Temp\tmpm0upp60n' cwd: C:\Users\REDACTED\AppData\Local\Temp\pip-install-jw1e9dw4\pyinstaller Complete output (38 lines): Error in sitecustomize; set PYTHONVERBOSE for traceback: SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data (sitecustomize.py, line 21) running dist_info creating C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info writing C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\PKG-INFO writing dependency_links to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\dependency_links.txt writing entry points to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\entry_points.txt writing requirements to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\requires.txt writing top-level names to C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\top_level.txt writing manifest file 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\SOURCES.txt' reading manifest file 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'pyinstaller-gui.py' no previously-included directories found matching 'bootloader\build' no previously-included directories found matching 'bootloader\.waf-*' no previously-included directories found matching 'bootloader\.waf3-*' no previously-included directories found matching 'bootloader\waf-*' no previously-included directories found matching 'bootloader\waf3-*' no previously-included directories found matching 'bootloader\_sdks' no previously-included directories found matching 'bootloader\.vagrant' warning: no previously-included files found matching 'bootloader\.lock-waf*' no previously-included directories found matching 'doc\source' no previously-included directories found matching 'doc\_build' warning: no previously-included files matching '*.tmp' found under directory 'doc' warning: no files found matching 'news\_template.rst' no previously-included directories found matching 'news' no previously-included directories found matching 'old' no previously-included directories found matching 'scripts' no previously-included directories found matching 'tests\scripts' no previously-included directories found matching '.github' warning: no previously-included files found matching '.*' warning: no previously-included files found matching '*.yml' warning: no previously-included files found matching '*~' warning: no previously-included files found matching '.directory' warning: no previously-included files matching '*.py[co]' found anywhere in distribution writing manifest file 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.egg-info\SOURCES.txt' creating 'C:\Users\REDACTED\AppData\Local\Temp\pip-modern-metadata-48slrgbm\pyinstaller.dist-info' error: invalid command 'bdist_wheel' ---------------------------------------- ERROR: Command errored out with exit status 1: 'C:\Program Files\Python39\python.exe' 'C:\Program Files\Python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\CIARND~1\AppData\Local\Temp\tmpm0upp60n' Check the logs for full command output. C:\WINDOWS\system32> C:\WINDOWS\system32>I think it's time to file a bug report. How do I do that? RE: Error with non-ASCII character? - snippsat - Nov-08-2020 (Nov-08-2020, 07:18 PM)giomach Wrote: I think it's time to file a bug report. How do I do that?Under issues see search if someone has same error first. Try with: pip --no-cache-dir install pyinstallerClean you Temp folder. C:\Users\REDACTED\AppData\Local\Temp\Search to see it you have sitecustomize.py ,t is not part of 3.9 file(i have search),so just remove file if have it try again.
|