UnicodeEncodeError when installing jupyter

713 views Asked by At

Python version: 2.7

Windows version: Windows 7 64bit

I have a problem when installing jupyter. As I do not like using Anaconda, I tried to install jupyter by:

pip install jupyter

However, I faced the following problem:

   File "c:\python27\lib\encodings\cp1252.py", line 12, in encode
   UnicodeEncodeError: 'charmap' codec can't encode characters in position 10-18: character maps to <undefined>

I serfed the net and found solutions only for issues with scripts but not with using pip install directly.

Here is one of the sources: UnicodeEncodeError: 'charmap' codec can't encode - character maps to <undefined>, print function

I tried to reinstall ipython and upgrade pip. However, everything is OK with them, and the problem remained unsolved.

I also tried to fix bugs within c:\python27\lib\encodings\cp1252.pybut could not do anything useful.

Please, help me with your own suggestions of this problem (or a solution if possible). Thanks in advance!

UPD: full error from cmd:

C:\Users\Александр>pip install jupyter
Collecting jupyter
  Using cached jupyter-1.0.0-py2.py3-none-any.whl
Collecting nbconvert (from jupyter)
  Using cached nbconvert-5.0.0-py2.py3-none-any.whl
Collecting notebook (from jupyter)
  Using cached notebook-4.3.1-py2.py3-none-any.whl
Collecting ipykernel (from jupyter)
  Using cached ipykernel-4.5.2-py2.py3-none-any.whl
Collecting jupyter-console (from jupyter)
  Using cached jupyter_console-5.0.0-py2.py3-none-any.whl
Collecting ipywidgets (from jupyter)
  Using cached ipywidgets-5.2.2-py2.py3-none-any.whl
Collecting qtconsole (from jupyter)
  Using cached qtconsole-4.2.1-py2.py3-none-any.whl
Collecting jinja2 (from nbconvert->jupyter)
  Using cached Jinja2-2.8.1-py2.py3-none-any.whl
Requirement already satisfied: pygments in c:\python27\lib\site-packages (from nbconvert->jupyter)
Collecting mistune!=0.6 (from nbconvert->jupyter)
  Using cached mistune-0.7.3-py2.py3-none-any.whl
Requirement already satisfied: traitlets>=4.2 in c:\python27\lib\site-packages (from nbconvert->jupyter)
Collecting nbformat (from nbconvert->jupyter)
  Using cached nbformat-4.2.0-py2.py3-none-any.whl
Collecting entrypoints>=0.2.2 (from nbconvert->jupyter)
  Using cached entrypoints-0.2.2-py2.py3-none-any.whl
Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter)
  Using cached pandocfilters-1.4.1.tar.gz
Collecting testpath (from nbconvert->jupyter)
  Using cached testpath-0.3-py2.py3-none-any.whl
Collecting jupyter-core (from nbconvert->jupyter)
  Using cached jupyter_core-4.2.1-py2.py3-none-any.whl
Collecting bleach (from nbconvert->jupyter)
  Using cached bleach-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: ipython-genutils in c:\python27\lib\site-packages(from notebook->jupyter)
Collecting jupyter-client (from notebook->jupyter)
  Using cached jupyter_client-4.4.0-py2.py3-none-any.whl
Collecting tornado>=4 (from notebook->jupyter)
  Using cached tornado-4.4.2.tar.gz
Requirement already satisfied: ipython>=4.0.0 in c:\python27\lib\site-packages (from ipykernel->jupyter)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.0 in c:\python27\lib\site-packages (from jupyter-console->jupyter)
Collecting widgetsnbextension>=1.2.6 (from ipywidgets->jupyter)
  Using cached widgetsnbextension-1.2.6-py2.py3-none-any.whl
Collecting MarkupSafe (from jinja2->nbconvert->jupyter)
  Using cached MarkupSafe-0.23.tar.gz
Requirement already satisfied: enum34; python_version == "2.7" in c:\python27\lib\site-packages (from traitlets>=4.2->nbconvert->jupyter)
Requirement already satisfied: six in c:\python27\lib\site-packages (from traitlets>=4.2->nbconvert->jupyter)
Requirement already satisfied: decorator in c:\python27\lib\site-packages (fromtraitlets>=4.2->nbconvert->jupyter)
Collecting jsonschema!=2.5.0,>=2.4 (from nbformat->nbconvert->jupyter)
  Using cached jsonschema-2.5.1-py2.py3-none-any.whl
Collecting configparser>=3.5; python_version == "2.7" (from entrypoints>=0.2.2->nbconvert->jupyter)
  Using cached configparser-3.5.0.tar.gz
Collecting html5lib!=0.9999,!=0.99999,<0.99999999,>=0.999 (from bleach->nbconvert->jupyter)
  Using cached html5lib-0.9999999.tar.gz
Collecting pyzmq>=13 (from jupyter-client->notebook->jupyter)
  Using cached pyzmq-16.0.2-cp27-cp27m-win_amd64.whl
Collecting singledispatch (from tornado>=4->notebook->jupyter)
  Using cached singledispatch-3.4.0.3-py2.py3-none-any.whl
Requirement already satisfied: certifi in c:\python27\lib\site-packages (from tornado>=4->notebook->jupyter)
Collecting backports_abc>=0.4 (from tornado>=4->notebook->jupyter)
  Using cached backports_abc-0.5-py2.py3-none-any.whl
Requirement already satisfied: win-unicode-console>=0.5; sys_platform == "win32" in c:\python27\lib\site-packages (from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: simplegeneric>0.8 in c:\python27\lib\site-packages (from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in c:\python27\lib\site-packages (from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: setuptools>=18.5 in c:\python27\lib\site-packages(from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: pathlib2; python_version == "2.7" or python_version == "3.3" in c:\python27\lib\site-packages (from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\lib\site-packages (from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: pickleshare in c:\python27\lib\site-packages (from ipython>=4.0.0->ipykernel->jupyter)
Requirement already satisfied: wcwidth in c:\python27\lib\site-packages (from prompt-toolkit<2.0.0,>=1.0.0->jupyter-console->jupyter)
Collecting functools32; python_version == "2.7" (from jsonschema!=2.5.0,>=2.4->nbformat->nbconvert->jupyter)
  Using cached functools32-3.2.3-2.zip
Installing collected packages: MarkupSafe, jinja2, mistune, jupyter-core, functools32, jsonschema, nbformat, configparser, entrypoints, pandocfilters, testpath, html5lib, bleach, nbconvert, singledispatch, backports-abc, tornado, pyzmq, jupyter-client, ipykernel, notebook, jupyter-console, widgetsnbextension, ipywidgets, qtconsole, jupyter
  Running setup.py install for MarkupSafe ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\8523~1\\appdata\\local\\temp\\pip-build-rwadde\\MarkupSafe\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().
replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\8523~1\appdata\local\temp\pip-gcsvl3-record\install-record.txt
--single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\markupsafe
copying markupsafe\tests.py -> build\lib.win-amd64-2.7\markupsafe
copying markupsafe\_compat.py -> build\lib.win-amd64-2.7\markupsafe
copying markupsafe\_constants.py -> build\lib.win-amd64-2.7\markupsafe
copying markupsafe\_native.py -> build\lib.win-amd64-2.7\markupsafe
copying markupsafe\__init__.py -> build\lib.win-amd64-2.7\markupsafe
running egg_info
writing MarkupSafe.egg-info\PKG-INFO
writing top-level names to MarkupSafe.egg-info\top_level.txt
writing dependency_links to MarkupSafe.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'MarkupSafe.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MarkupSafe.egg-info\SOURCES.txt'
copying markupsafe\_speedups.c -> build\lib.win-amd64-2.7\markupsafe
running build_ext
building 'markupsafe._speedups' extension
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\8523~1\appdata\local\temp\pip-build-rwadde\MarkupSafe\setup.py", line 120, in <module>
    try_building_extension()
  File "c:\users\8523~1\appdata\local\temp\pip-build-rwadde\MarkupSafe\setup.py", line 99, in try_building_extension
    run_setup(True)
  File "c:\users\8523~1\appdata\local\temp\pip-build-rwadde\MarkupSafe\setup.py", line 93, in run_setup
    ext_modules=ext_modules,
  File "c:\python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "c:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\python27\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "c:\python27\lib\distutils\command\install.py", line 563, in run
    self.run_command('build')
  File "c:\python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "c:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "c:\python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "c:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\users\8523~1\appdata\local\temp\pip-build-rwadde\MarkupSafe\setup.py", line 41, in run
    build_ext.run(self)
  File "c:\python27\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
  File "c:\python27\lib\distutils\command\build_ext.py", line 448, in build_extensions
    self.build_extension(ext)
  File "c:\users\8523~1\appdata\local\temp\pip-build-rwadde\MarkupSafe\setup.py", line 47, in build_extension
    build_ext.build_extension(self, ext)
  File "c:\python27\lib\distutils\command\build_ext.py", line 498, in build_extension
    depends=ext.depends)
  File "c:\python27\lib\distutils\msvc9compiler.py", line 473, in compile
    self.initialize()
  File "c:\python27\lib\distutils\msvc9compiler.py", line 383, in initialize

    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "c:\python27\lib\site-packages\setuptools\msvc9_support.py", line 52, in query_vcvarsall
    return unpatched['query_vcvarsall'](version, *args, **kwargs)
  File "c:\python27\lib\distutils\msvc9compiler.py", line 275, in query_vcvarsall
    stderr=subprocess.PIPE)
  File "c:\python27\lib\subprocess.py", line 711, in __init__
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 959, in _execute_child
    startupinfo)
  File "c:\python27\lib\encodings\cp1252.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 10-18: character maps to <undefined>
1

There are 1 answers

0
Alex On BEST ANSWER

Solved this problem by changing to an ASCII-like name.

Link to a step-by-step guide (for Win7): https://social.technet.microsoft.com/wiki/contents/articles/19834.how-to-rename-a-windows-7-user-account-and-related-profile-folder.aspx