pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.81k stars 386 forks source link

pdm not working on macOS 15.0 #3175

Open marswong opened 1 day ago

marswong commented 1 day ago

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  1. install pdm through brew install pdm on macOS 15.0
  2. run pdm self update -v

Actual behavior

Traceback (most recent call last):
  File "/opt/homebrew/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/core.py", line 351, in main
    return core.main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/core.py", line 269, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/core.py", line 264, in main
    self.handle(project, options)
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/core.py", line 196, in handle
    command.handle(project, options)
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/cli/commands/self_cmd.py", line 232, in handle
    version = get_latest_pdm_version_from_pypi(project, options.pre)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/cli/actions.py", line 410, in get_latest_pdm_version_from_pypi
    with environment.get_finder([project.default_source]) as finder:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/environments/base.py", line 146, in get_finder
    session=self.session,
            ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/functools.py", line 993, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/environments/base.py", line 103, in session
    return self._build_session()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/environments/base.py", line 85, in _build_session
    from pdm.models.session import PDMPyPIClient
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/models/session.py", line 46, in <module>
    _ssl_context = _create_truststore_ssl_context()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/pdm/models/session.py", line 42, in _create_truststore_ssl_context
    ctx.load_verify_locations(certifi.where())
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/truststore/_api.py", line 135, in load_verify_locations
    return self._ctx.load_verify_locations(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory

Expected behavior

No errors.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.18.2
Python Interpreter:
  ~/.venv/bin/python (3.9)
Project Root:
  ~
Local Packages:

WARNING: Failed to get latest version: [Errno 2] No such file or directory
{
  "implementation_name": "cpython",
  "implementation_version": "3.12.6",
  "os_name": "posix",
  "platform_machine": "arm64",
  "platform_release": "24.0.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 24.0.0: Mon Aug 12 20:49:48 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T8103",
  "python_full_version": "3.9.19",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "darwin"
}
WARNING: Failed to get latest version: [Errno 2] No such file or directory

always get an error of FileNotFoundError: [Errno 2] No such file or directory while running any comand.

frostming commented 22 hours ago

Run this small snippet and see if that produces error:

import truststore, certifi, ssl

ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
cert_path = certifi.where()
print(cert_path)
ctx.load_verify_locations(cert_path)
marswong commented 20 hours ago

Run this small snippet and see if that produces error:

import truststore, certifi, ssl

ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
cert_path = certifi.where()
print(cert_path)
ctx.load_verify_locations(cert_path)

I cannot install truststore using my default python version 3.9.19, but it works fine if I switch to 3.12.6 using pyenv.

frostming commented 20 hours ago

run that in the same environment of pdm

marswong commented 20 hours ago

run that in the same environment of pdm

same as the error logs above:

Python 3.12.6 (main, Sep  6 2024, 19:03:47) [Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import truststore, certifi, ssl
>>> ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
>>> cert_path = certifi.where()
>>> print(cert_path)
/opt/homebrew/opt/certifi/lib/python3.12/site-packages/certifi/cacert.pem
>>> ctx.load_verify_locations(cert_path)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/Cellar/pdm/2.18.2/libexec/lib/python3.12/site-packages/truststore/_api.py", line 135, in load_verify_locations
    return self._ctx.load_verify_locations(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory
frostming commented 19 hours ago

does the cert_path exist? and anyway it proves not a problem of pdm

marswong commented 7 hours ago

does the cert_path exist? and anyway it proves not a problem of pdm

Yes, but the cacert.pem is a blank file, is it expected? So how can I fix this, it worked before upgrading to macOS 15.0

frostming commented 7 hours ago

try reinstalling the forluma with homebrew