Skip to content

pip install fails on Windows 11 #367

@imnasnainaec

Description

@imnasnainaec

When I run, in PowerShell, in a (venv), pip install git+https://github.com/LettError/MutatorMath.git@b0a87ec54df25ccbe6cc37825dd1d335efbce4a6:

Collecting git+https://github.com/LettError/MutatorMath.git@b0a87ec54df25ccbe6cc37825dd1d335efbce4a6
  Cloning https://github.com/LettError/MutatorMath.git (to revision b0a87ec54df25ccbe6cc37825dd1d335efbce4a6) to ~\AppData\Local\Temp\pip-req-build-bjgfvf7x
  Running command git clone --filter=blob:none --quiet https://github.com/LettError/MutatorMath.git '~\AppData\Local\Temp\pip-req-build-bjgfvf7x'
  Running command git rev-parse -q --verify 'sha^b0a87ec54df25ccbe6cc37825dd1d335efbce4a6'
  Running command git fetch -q https://github.com/LettError/MutatorMath.git b0a87ec54df25ccbe6cc37825dd1d335efbce4a6
  Resolved https://github.com/LettError/MutatorMath.git to commit b0a87ec54df25ccbe6cc37825dd1d335efbce4a6
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "~\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
        File "~\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "~\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "~\AppData\Local\Temp\pip-build-env-3p8hsuen\overlay\Lib\site-packages\setuptools\build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "~\AppData\Local\Temp\pip-build-env-3p8hsuen\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
          self.run_setup()
        File "~\AppData\Local\Temp\pip-build-env-3p8hsuen\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 179, in <module>
        File "C:\Program Files\Python312\Lib\encodings\cp1252.py", line 23, in decode
          return codecs.charmap_decode(input,self.errors,decoding_table)[0]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 5723: character maps to <undefined>
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'git+https://github.com/LettError/MutatorMath.git@b0a87ec54df25ccbe6cc37825dd1d335efbce4a6' when getting requirements to build wheel

According to Gemini:

The script is trying to read a local text file (like README.md or LICENSE) using Python's default open() method without explicitly specifying an encoding parameter (e.g., encoding='utf-8'). Because Windows defaults to cp1252 instead of utf-8, Python encounters a non-ASCII character (like an accented letter or a special symbol) and crashes on Windows machines during pip install.

The workaround is to first set

$env:PYTHONUTF8=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions