Skip to content

Build errors when installing recent versions on Windows #12

@brandon-avantus

Description

@brandon-avantus

When attempting to install vocmax 1.0.2, 1.0.3, or 1.0.4 on Windows, the following error occurs when pip (or uv pip) attempts to build the package from the source distribution:

C:\Users\brandon\devel\8me> uv pip install vocmax==1.0.4
Using Python 3.11.11 environment at: C:\Users\brandon\devel\8me\.venv
Resolved 28 packages in 465ms
  × Failed to build `vocmax==1.0.4`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit code: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "C:\Users\brandon\AppData\Local\uv\cache\builds-v0\.tmpfnfBKE\Lib\site-packages\setuptools\build_meta.py",
      line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\brandon\AppData\Local\uv\cache\builds-v0\.tmpfnfBKE\Lib\site-packages\setuptools\build_meta.py",
      line 304, in _get_build_requires
          self.run_setup()
        File "C:\Users\brandon\AppData\Local\uv\cache\builds-v0\.tmpfnfBKE\Lib\site-packages\setuptools\build_meta.py",
      line 522, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\brandon\AppData\Local\uv\cache\builds-v0\.tmpfnfBKE\Lib\site-packages\setuptools\build_meta.py",
      line 320, in run_setup
          exec(code, locals())
        File "<string>", line 4, in <module>
        File
      "C:\Users\brandon\AppData\Roaming\uv\data\python\cpython-3.11.11-windows-x86_64-none\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 0x9d in position 5732: character maps to <undefined>

      hint: This usually indicates a problem with the package or the build environment.

The same error occurs when attempting to build version 1.0.1 from source as well. Since there is a wheel for version 1.0.1, however, installing it with pip works without error.

The problem stems from reading the README.md file from setup.py. On Windows, the cp1252 codec is being used by default to decode the unicode characters in the file, resulting in a decode error. If UTF-8 is forced, by setting PYTHONUTF8=1 in the environment, then it works as expected. A better solution is to explicitly pass encoding="utf-8" to the open call in setup.py.

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