Skip to content

Install error on Windows 11 Chinese Version #3485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
JamCh01 opened this issue Apr 18, 2025 · 5 comments · Fixed by #3526
Closed
1 task

Install error on Windows 11 Chinese Version #3485

JamCh01 opened this issue Apr 18, 2025 · 5 comments · Fixed by #3526
Labels
🐛 bug Something isn't working

Comments

@JamCh01
Copy link

JamCh01 commented Apr 18, 2025

Describe the bug

PS C:\Users\user\Desktop> powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | py -"
Installing PDM (latest): Creating virtual environment
Installing PDM (latest): Installing PDM and dependencies
An error occurred when executing ['C:\\Users\\user\\AppData\\Roaming\\pdm\\venv\\Scripts\\python.exe', '-Im', 'pip', 'install', 'pdm[locked]']:
Traceback (most recent call last):
  File "<stdin>", line 41, in _call_subprocess
  File "D:\Program Files\Python313\Lib\subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\Users\\user\\AppData\\Roaming\\pdm\\venv\\Scripts\\python.exe', '-Im', 'pip', 'install', 'pdm[locked]']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 460, in <module>
  File "<stdin>", line 456, in main
  File "<stdin>", line 354, in install
  File "<stdin>", line 281, in _install
  File "<stdin>", line 44, in _call_subprocess
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 12462: invalid start byte

Python Version for venv

PS C:\Users\user\Desktop> C:\\Users\\user\\AppData\\Roaming\\pdm\\venv\\Scripts\\python.exe -V
Python 3.13.1

Python Version for installed

PS C:\Users\user\Desktop> python -V
Python 3.13.1

try to run subprocess

PS C:\Users\user\Desktop> C:\\Users\\user\\AppData\\Roaming\\pdm\\venv\\Scripts\\python.exe -Im pip install pdm[locked]
Collecting pdm[locked]
  Using cached pdm-2.24.0-py3-none-any.whl.metadata (15 kB)
Collecting blinker (from pdm[locked])
  Using cached blinker-1.9.0-py3-none-any.whl.metadata (1.6 kB)
Collecting packaging!=22.0,>=20.9 (from pdm[locked])
  Using cached packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
Collecting platformdirs (from pdm[locked])
  Using cached platformdirs-4.3.7-py3-none-any.whl.metadata (11 kB)
Collecting rich>=12.3.0 (from pdm[locked])
  Using cached rich-14.0.0-py3-none-any.whl.metadata (18 kB)
Collecting virtualenv>=20 (from pdm[locked])
  Using cached virtualenv-20.30.0-py3-none-any.whl.metadata (4.5 kB)
Collecting pyproject-hooks (from pdm[locked])
  Using cached pyproject_hooks-1.2.0-py3-none-any.whl.metadata (1.3 kB)
Collecting unearth>=0.17.5 (from pdm[locked])
  Using cached unearth-0.17.5-py3-none-any.whl.metadata (3.7 kB)
Collecting dep-logic>=0.5 (from pdm[locked])
  Using cached dep_logic-0.5.0-py3-none-any.whl.metadata (2.9 kB)
Collecting findpython<1.0.0a0,>=0.6.0 (from pdm[locked])
  Using cached findpython-0.6.3-py3-none-any.whl.metadata (5.3 kB)
Collecting tomlkit<1,>=0.11.1 (from pdm[locked])
  Using cached tomlkit-0.13.2-py3-none-any.whl.metadata (2.7 kB)
Collecting shellingham>=1.3.2 (from pdm[locked])
  Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting python-dotenv>=0.15 (from pdm[locked])
  Using cached python_dotenv-1.1.0-py3-none-any.whl.metadata (24 kB)
Collecting resolvelib>=1.1 (from pdm[locked])
  Using cached resolvelib-1.1.0-py2.py3-none-any.whl.metadata (3.7 kB)
Collecting installer<0.8,>=0.7 (from pdm[locked])
  Using cached installer-0.7.0-py3-none-any.whl.metadata (936 bytes)
Collecting truststore>=0.9 (from pdm[locked])
  Using cached truststore-0.10.1-py3-none-any.whl.metadata (4.4 kB)
Collecting hishel>=0.0.32 (from pdm[locked])
  Using cached hishel-0.1.2-py3-none-any.whl.metadata (12 kB)
Collecting msgpack>=1.0 (from pdm[locked])
  Using cached msgpack-1.1.0.tar.gz (167 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pbs-installer>=2024.4.18 (from pdm[locked])
  Using cached pbs_installer-2025.4.9-py3-none-any.whl.metadata (990 bytes)
Collecting httpx<1,>0.20 (from httpx[socks]<1,>0.20->pdm[locked])
  Using cached httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)
Collecting filelock>=3.13 (from pdm[locked])
  Using cached filelock-3.18.0-py3-none-any.whl.metadata (2.9 kB)
Collecting httpcore>=1.0.6 (from pdm[locked])
  Using cached httpcore-1.0.8-py3-none-any.whl.metadata (21 kB)
Collecting certifi>=2024.8.30 (from pdm[locked])
  Using cached certifi-2025.1.31-py3-none-any.whl.metadata (2.5 kB)
Collecting id>=1.5.0 (from pdm[locked])
  Using cached id-1.5.0-py3-none-any.whl.metadata (5.2 kB)
Collecting anyio==4.3.0 (from pdm[locked])
  Using cached anyio-4.3.0-py3-none-any.whl.metadata (4.6 kB)
Collecting blinker (from pdm[locked])
  Using cached blinker-1.8.2-py3-none-any.whl.metadata (1.6 kB)
Collecting certifi>=2024.8.30 (from pdm[locked])
  Using cached certifi-2024.8.30-py3-none-any.whl.metadata (2.2 kB)
Collecting charset-normalizer==3.3.2 (from pdm[locked])
  Using cached charset_normalizer-3.3.2-py3-none-any.whl.metadata (33 kB)
Collecting distlib==0.3.8 (from pdm[locked])
  Using cached distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)
Collecting filelock>=3.13 (from pdm[locked])
  Using cached filelock-3.16.1-py3-none-any.whl.metadata (2.9 kB)
Collecting h11==0.14.0 (from pdm[locked])
  Using cached h11-0.14.0-py3-none-any.whl.metadata (8.2 kB)
Collecting hishel>=0.0.32 (from pdm[locked])
  Using cached hishel-0.0.33-py3-none-any.whl.metadata (11 kB)
Collecting httpcore>=1.0.6 (from pdm[locked])
  Using cached httpcore-1.0.6-py3-none-any.whl.metadata (21 kB)
Collecting httpx<1,>0.20 (from httpx[socks]<1,>0.20->pdm[locked])
  Using cached httpx-0.27.2-py3-none-any.whl.metadata (7.1 kB)
Collecting idna==3.6 (from pdm[locked])
  Using cached idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Collecting markdown-it-py==3.0.0 (from pdm[locked])
  Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting mdurl==0.1.2 (from pdm[locked])
  Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
Collecting packaging!=22.0,>=20.9 (from pdm[locked])
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting pbs-installer>=2024.4.18 (from pdm[locked])
  Using cached pbs_installer-2025.2.12-py3-none-any.whl.metadata (991 bytes)
Collecting platformdirs (from pdm[locked])
  Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB)
Collecting pygments==2.17.2 (from pdm[locked])
  Using cached pygments-2.17.2-py3-none-any.whl.metadata (2.6 kB)
Collecting python-dotenv>=0.15 (from pdm[locked])
  Using cached python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Collecting requests==2.31.0 (from pdm[locked])
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting rich>=12.3.0 (from pdm[locked])
  Using cached rich-13.9.2-py3-none-any.whl.metadata (18 kB)
Collecting sniffio==1.3.1 (from pdm[locked])
  Using cached sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting socksio==1.0.0 (from pdm[locked])
  Using cached socksio-1.0.0-py3-none-any.whl.metadata (6.1 kB)
Collecting truststore>=0.9 (from pdm[locked])
  Using cached truststore-0.9.2-py3-none-any.whl.metadata (4.4 kB)
Collecting typing-extensions==4.12.2 (from pdm[locked])
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting urllib3==2.2.1 (from pdm[locked])
  Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting virtualenv>=20 (from pdm[locked])
  Using cached virtualenv-20.27.0-py3-none-any.whl.metadata (4.5 kB)
Using cached anyio-4.3.0-py3-none-any.whl (85 kB)
Using cached blinker-1.8.2-py3-none-any.whl (9.5 kB)
Using cached certifi-2024.8.30-py3-none-any.whl (167 kB)
Using cached charset_normalizer-3.3.2-py3-none-any.whl (48 kB)
Using cached dep_logic-0.5.0-py3-none-any.whl (35 kB)
Using cached distlib-0.3.8-py2.py3-none-any.whl (468 kB)
Using cached filelock-3.16.1-py3-none-any.whl (16 kB)
Using cached findpython-0.6.3-py3-none-any.whl (20 kB)
Using cached h11-0.14.0-py3-none-any.whl (58 kB)
Using cached hishel-0.0.33-py3-none-any.whl (41 kB)
Using cached httpcore-1.0.6-py3-none-any.whl (78 kB)
Using cached httpx-0.27.2-py3-none-any.whl (76 kB)
Using cached id-1.5.0-py3-none-any.whl (13 kB)
Using cached idna-3.6-py3-none-any.whl (61 kB)
Using cached installer-0.7.0-py3-none-any.whl (453 kB)
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Using cached pbs_installer-2025.2.12-py3-none-any.whl (53 kB)
Using cached platformdirs-4.3.6-py3-none-any.whl (18 kB)
Using cached pygments-2.17.2-py3-none-any.whl (1.2 MB)
Using cached pyproject_hooks-1.2.0-py3-none-any.whl (10 kB)
Using cached python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Using cached resolvelib-1.1.0-py2.py3-none-any.whl (18 kB)
Using cached rich-13.9.2-py3-none-any.whl (242 kB)
Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Using cached socksio-1.0.0-py3-none-any.whl (12 kB)
Using cached tomlkit-0.13.2-py3-none-any.whl (37 kB)
Using cached truststore-0.9.2-py3-none-any.whl (17 kB)
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Using cached unearth-0.17.5-py3-none-any.whl (47 kB)
Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
Using cached virtualenv-20.27.0-py3-none-any.whl (3.1 MB)
Using cached pdm-2.24.0-py3-none-any.whl (289 kB)
Building wheels for collected packages: msgpack
  Building wheel for msgpack (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for msgpack (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [92 lines of output]
      C:\Users\user\AppData\Local\Temp\pip-build-env-hcs463v5\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!

              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).

              By 2026-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        corresp(dist, value, root_dir)
      C:\Users\user\AppData\Local\Temp\pip-build-env-hcs463v5\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: Apache Software License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        dist._finalize_license_expression()
      C:\Users\user\AppData\Local\Temp\pip-build-env-hcs463v5\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: Apache Software License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-313t\msgpack
      copying msgpack\exceptions.py -> build\lib.win-amd64-cpython-313t\msgpack
      copying msgpack\ext.py -> build\lib.win-amd64-cpython-313t\msgpack
      copying msgpack\fallback.py -> build\lib.win-amd64-cpython-313t\msgpack
      copying msgpack\__init__.py -> build\lib.win-amd64-cpython-313t\msgpack
      running build_ext
      building 'msgpack._cmsgpack' extension
      creating build\temp.win-amd64-cpython-313t\Release\msgpack
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -D__LITTLE_ENDIAN__=1 -DPy_GIL_DISABLED=1 -I. -IC:\Users\user\AppData\Roaming\pdm\venv\include "-ID:\Program Files\Python313\include" "-ID:\Program Files\Python313\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcmsgpack/_cmsgpack.c /Fobuild\temp.win-amd64-cpython-313t\Release\msgpack\_cmsgpack.obj
      _cmsgpack.c
      C:\Users\user\AppData\Local\Temp\pip-install-9tblky_z\msgpack_f34c2754ebe34d8a995b2e3b4a4485f4\msgpack\pack_template.h(530): warning C4267: “=”: 从“size_t”转换到“unsigned char”,可能丢失数据
      C:\Users\user\AppData\Local\Temp\pip-install-9tblky_z\msgpack_f34c2754ebe34d8a995b2e3b4a4485f4\msgpack\unpack.h(352): warning C4244: “函数”: 从“int64_t”转换到“int”,可能丢失数据
      C:\Users\user\AppData\Local\Temp\pip-install-9tblky_z\msgpack_f34c2754ebe34d8a995b2e3b4a4485f4\msgpack\unpack_template.h(251): warning C4244: “函数”: 从“double”转换到“float”,可能丢失数据
      C:\Users\user\AppData\Local\Temp\pip-install-9tblky_z\msgpack_f34c2754ebe34d8a995b2e3b4a4485f4\msgpack\unpack_template.h(324): warning C4244: “函数”: 从“Py_ssize_t”转换到“unsigned int”,可能丢失数据
      C:\Users\user\AppData\Local\Temp\pip-install-9tblky_z\msgpack_f34c2754ebe34d8a995b2e3b4a4485f4\msgpack\unpack_template.h(338): warning C4244: “函数”: 从“Py_ssize_t”转换到“unsigned int”,可能丢失数据
      msgpack/_cmsgpack.c(2343): error C2146: 语法错误: 缺少“)”(在标识符“vc”的前面)
      msgpack/_cmsgpack.c(2343): error C2081: “__pyx_vectorcallfunc”: 形参表中的名称非法
      msgpack/_cmsgpack.c(2343): error C2061: 语法错误: 标识符“vc”
      msgpack/_cmsgpack.c(2343): error C2059: 语法错误:“;”
      msgpack/_cmsgpack.c(2343): error C2059: 语法错误:“,”
      msgpack/_cmsgpack.c(2343): error C2059: 语法错误:“)”
      msgpack/_cmsgpack.c(6941): warning C4996: 'Py_OptimizeFlag': deprecated in 3.12
      msgpack/_cmsgpack.c(8188): warning C4244: “函数”: 从“Py_ssize_t”转换到“unsigned int”,可能丢失数据
      msgpack/_cmsgpack.c(8343): warning C4244: “函数”: 从“long”转换到“char”,可能丢失数据
      msgpack/_cmsgpack.c(8493): warning C4244: “函数”: 从“Py_ssize_t”转换到“unsigned int”,可能丢失数据
      msgpack/_cmsgpack.c(9882): warning C4244: “函数”: 从“__int64”转换到“unsigned int”,可能丢失数据
      msgpack/_cmsgpack.c(10124): warning C4244: “函数”: 从“__int64”转换到“unsigned int”,可能丢失数据
      msgpack/_cmsgpack.c(10386): warning C4244: “函数”: 从“Py_ssize_t”转换到“unsigned int”,可能丢失数据
      msgpack/_cmsgpack.c(21391): error C2146: 语法错误: 缺少“)”(在标识符“vc”的前面)
      msgpack/_cmsgpack.c(21391): error C2081: “__pyx_vectorcallfunc”: 形参表中的名称非法
      msgpack/_cmsgpack.c(21391): error C2061: 语法错误: 标识符“vc”
      msgpack/_cmsgpack.c(21391): error C2059: 语法错误:“;”
      msgpack/_cmsgpack.c(21391): error C2059: 语法错误:“,”
      msgpack/_cmsgpack.c(21391): error C2059: 语法错误:“)”
      msgpack/_cmsgpack.c(21436): error C2146: 语法错误: 缺少“)”(在标识符“vc”的前面)
      msgpack/_cmsgpack.c(21436): error C2081: “__pyx_vectorcallfunc”: 形参表中的名称非法
      msgpack/_cmsgpack.c(21436): error C2061: 语法错误: 标识符“vc”
      msgpack/_cmsgpack.c(21436): error C2059: 语法错误:“;”
      msgpack/_cmsgpack.c(21436): error C2059: 语法错误:“,”
      msgpack/_cmsgpack.c(21436): error C2059: 语法错误:“)”
      msgpack/_cmsgpack.c(22125): error C2065: “__pyx_vectorcallfunc”: 未声明的标识符
      msgpack/_cmsgpack.c(22125): error C2146: 语法错误: 缺少“;”(在标识符“vc”的前面)
      msgpack/_cmsgpack.c(22125): error C2065: “vc”: 未声明的标识符
      msgpack/_cmsgpack.c(22125): warning C4047: “=”:“int”与“vectorcallfunc”的间接级别不同
      msgpack/_cmsgpack.c(22126): error C2065: “vc”: 未声明的标识符
      msgpack/_cmsgpack.c(22128): warning C4013: “__Pyx_PyVectorcall_FastCallDict”未定义;假设外部返回 int
      msgpack/_cmsgpack.c(22128): error C2065: “vc”: 未声明的标识符
      msgpack/_cmsgpack.c(22128): warning C4047: “return”:“PyObject *”与“int”的间接级别不同
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for msgpack
Failed to build msgpack
ERROR: Failed to build installable wheels for some pyproject.toml based projects (msgpack)

To reproduce

just run windows install command

Expected Behavior

it seems like msgpack's pyproject.toml error

Environment Information

nothing XD

Verbose Command Output

No response

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.
@JamCh01 JamCh01 added the 🐛 bug Something isn't working label Apr 18, 2025
@frostming
Copy link
Collaborator

The problem lies in your system, where it can't compile msgpack on Python 3.13

Try fixing the compiling issue or using an older Python version.

@waketzheng
Copy link
Contributor

waketzheng commented Apr 25, 2025

@JamCh01 May be you can use pipx to install pdm:

python -m pip install --upgrade --user pip pipx
python -m pipx ensurepath
python -m pipx install pdm

If it not work either, you can use json to replace msgpack(src/pdm/models/serializers.py):

try:
    import msgpack
except ImportError:
    import base64
    import json

    class Encoder(json.JSONEncoder):
        bytes_ident = "PDM_BYTES_OBJECT"

        def default(self, obj: Any) -> Any:
            if isinstance(obj, bytes):
                return {
                    "type": self.bytes_ident,
                    "val": base64.b64encode(obj).decode(),
                }
            return super().default(obj)

    def object_hook(obj: Any) -> Any:
        if isinstance(obj, dict) and obj.get("type") == Encoder.bytes_ident:
            val = obj.get("val")
            if val is not None and isinstance(val, str):
                return base64.b64decode(val)
        return obj

    class msgpack:
        UnpackValueError = json.JSONDecodeError

        @staticmethod
        def packb(data: dict, use_bin_type: bool = True) -> bytes:
            return json.dumps(data, cls=Encoder).encode()

        @staticmethod
        def loads(data: bytes, raw: bool = False) -> Any:
            return json.loads(data, object_hook=object_hook)
  • Install from source
git clone https://github.com/pdm-project/pdm
cd pdm
vi src/pdm/models/serializers.py
pipx install -e .
pdm --version

@waketzheng
Copy link
Contributor

@frostming MessagePack is not so mature as JSON. How about use orjson instead of msgpack? Or make msgpack to be optional.

@machenme
Copy link

machenme commented Apr 28, 2025

The problem lies in your system, where it can't compile msgpack on Python 3.13问题出在你的系统上,它无法在 Python 3.13 上编译 msgpack

Try fixing the compiling issue or using an older Python version.尝试修复编译问题或使用较旧的 Python 版本。

python 3.12.10 have same issue but with pdm init.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\users\chen\appdata\roaming\python\scripts\pdm.exe\__main__.py", line 7, in <module>
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\core.py", line 391, in main
    return core.main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\core.py", line 270, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\core.py", line 265, in main
    self.handle(project, options)
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\core.py", line 195, in handle
    command.handle(project, options)
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\cli\commands\init.py", line 295, in handle
    actions.ask_for_import(project)
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\cli\actions.py", line 313, in ask_for_import
    importable_files = list(find_importable_files(project))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\cli\utils.py", line 578, in find_importable_files
    if module.check_fingerprint(project, project_file.as_posix()):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chen\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\formats\flit.py", line 29, in check_fingerprint
    data = tomllib.load(fp)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\chen\AppData\Local\Programs\Python\Python312\Lib\tomllib\_parser.py", line 61, in load
    s = b.decode()
        ^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

@frostming
Copy link
Collaborator

@machenme that is a different issue, make sure your encoding of pyproject.toml is UTF-8 without BOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
4 participants