protoactor-python icon indicating copy to clipboard operation
protoactor-python copied to clipboard

Virtualenv installation failure due to U+0441 character

Open acolley opened this issue 5 years ago • 0 comments

OS = Windows 10 Shell = PowerShell Python = 3.8 Version = current master HEAD: 94bb4220bbef7a7cee50f6829fcf4d4362e487c6

While installing the library into a virtualenv I encountered the following error:

PS C:\Users\user\dev\protoactor-python> python -m venv .venv
PS C:\Users\user\dev\protoactor-python> .\.venv\Scripts\Activate.ps1
(.venv) PS C:\Users\user\dev\protoactor-python> pip install .
Processing c:\users\user\dev\protoactor-python
Installing collected packages: ProtoActor-Python
  Running setup.py install for ProtoActor-Python ... error
    ERROR: Command errored out with exit status 1:
<snip>
byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\grain_call_options.py to grain_call_options.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\hash_algorithms\fnv1a32.py to fnv1a32.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\member_status.py to member_status.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\member_status_events.py to member_status_events.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\member_strategy.py to member_strategy.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\messages.py to messages.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\pid_cache.py to pid_cache.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\protos_grpc.py to protos_grpc.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\protos_pb2.py to protos_pb2.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\providers\abstract_cluster_provider.py to abstract_cluster_provider.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\providers\consul\consul_client.py to consul_client.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\providers\consul\consul_provider.py to consul_provider.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\providers\single_remote_instance\protos_grpc.py to protos_grpc.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\providers\single_remote_instance\protos_pb2.py to protos_pb2.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\providers\single_remote_instance\single_remote_instance_provider.py to single_remote_instance_provider.cpython-38.pyc     
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\rendezvous.py to rendezvous.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\round_robin.py to round_robin.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\__init__.py to __init__.cpython-38.pyc
    byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\\u0441luster\\u0441luster.py to \u0441luster.cpython-38.pyc
    running install_egg_info
    Copying ProtoActor_Python.egg-info to c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\ProtoActor_Python-0.0.1-py3.8.egg-info
    running install_scripts
    writing list of installed files to 'C:\Users\user\AppData\Local\Temp\pip-record-tvyx015h\install-record.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-req-build-mln533kl\setup.py", line 13, in <module>
        setup(
      File "c:\users\user\dev\protoactor-python\.venv\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Python38\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python38\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Python38\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\user\dev\protoactor-python\.venv\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Python38\lib\distutils\command\install.py", line 569, in run
        self.execute(write_file,
      File "C:\Python38\lib\distutils\cmd.py", line 335, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "C:\Python38\lib\distutils\util.py", line 303, in execute
        func(*args)
      File "C:\Python38\lib\distutils\file_util.py", line 236, in write_file
        f.write(line + "\n")
      File "C:\Python38\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode character '\u0441' in position 80: character maps to <undefined>
<snip>

According to the output this appeared to be caused by a unicode U+0441 character in the protoactor-python.cluster module name.

I saw that the module protoactor-python.cluster module was duplicated. This is presumably because of the U+0441 character used in place of the c character in one of them. I removed the directory with the unicode character and left the other directory intact.

After removing the virtualenv, re-creating and running pip install . again the operation failed with a similar error:

PS C:\Users\user\dev\protoactor-python> python -m venv .venv
PS C:\Users\user\dev\protoactor-python> .\.venv\Scripts\Activate.ps1
(.venv) PS C:\Users\user\dev\protoactor-python> pip install .
Processing c:\users\user\dev\protoactor-python
Installing collected packages: ProtoActor-Python
  Running setup.py install for ProtoActor-Python ... error
    ERROR: Command errored out with exit status 1:
<snip>
byte-compiling c:\users\user\dev\protoactor-python\.venv\Lib\site-packages\protoactor\cluster\\u0441luster.py to \u0441luster.cpython-38.pyc
<snip>
 Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-req-build-hpnot7yh\setup.py", line 13, in <module>
        setup(
      File "c:\users\user\dev\protoactor-python\.venv\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Python38\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python38\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Python38\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\user\dev\protoactor-python\.venv\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Python38\lib\distutils\command\install.py", line 569, in run
        self.execute(write_file,
      File "C:\Python38\lib\distutils\cmd.py", line 335, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "C:\Python38\lib\distutils\util.py", line 303, in execute
        func(*args)
      File "C:\Python38\lib\distutils\file_util.py", line 236, in write_file
        f.write(line + "\n")
      File "C:\Python38\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode character '\u0441' in position 80: character maps to <undefined>
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\dev\protoactor-python\.venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-build-hpnot7yh\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-build-hpnot7yh\\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\user\AppData\Local\Temp\pip-record-_chmkv9x\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\dev\protoactor-python\.venv\include\site\python3.8\ProtoActor-Python' Check the logs for full command output.

This was due to the U+0441 character in the remaining protoactor-python.cluster module's cluster.py module name.

After renaming this module to use c instead of U+0441 the installation completed successfully:

(.venv) PS C:\Users\user\dev\protoactor-python> pip install .
Processing c:\users\user\dev\protoactor-python
Installing collected packages: ProtoActor-Python
  Found existing installation: ProtoActor-Python 0.0.1
    Uninstalling ProtoActor-Python-0.0.1:
      Successfully uninstalled ProtoActor-Python-0.0.1
  Running setup.py install for ProtoActor-Python ... done
Successfully installed ProtoActor-Python-0.0.1

acolley avatar Sep 26 '20 11:09 acolley