Skip to content

pdm attempts and fails to install cx-oracle instead of oracledb #3754

@zoof

Description

@zoof

Describe the bug

Using an existing pyproject.toml file from uv:

[project]
name = "base-Python-environment"
version = "0.1.0"
description = "Packages for a base Python environment"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "oracledb",
    "scikit-learn",
    "pandas[excel]",
    "polars[excel]",
    "pyreadstat",
    "polars_readstat",
    "pyarrow",
    "seaborn",
    "plotly",
    "matplotlib",
    "statsmodels",
]

[dependency-groups]
dev = [
    "ipywidgets",
    "ipykernel",
    "notebook",
    "lab",
    "jupytext",
    "tqdm",
]

instead of installing oracledb on a Windows 11 machine, it attempts to install cx-oracle and fails:

$ pdm install
Synchronizing working set with resolved packages: 1 to add, 0 to update, 0 to remove

  ✖ Install cx-oracle 8.3.0 failed
  ✖ Install cx-oracle 8.3.0 failed

ERRORS:
add cx-oracle failed:
Traceback (most recent call last):
  File "C:\Program Files\Python312\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\installers\synchronizers.py",
line 29, in install_candidate
    self.manager.install(can)
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\installers\manager.py",
line 33, in install
    prepared.build(),
    ^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\models\candidates.py",
line 426, in build
    self._cached = Path(builder.build(build_dir, metadata_directory=self._metadata_dir))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\builders\base.py", line
84, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\builders\wheel.py",
line 24, in build
    requires = self._hook.get_requires_for_build_wheel(self.config_settings)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pyproject_hooks\_impl.py",
line 196, in get_requires_for_build_wheel
    return self._call_hook(
           ^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pyproject_hooks\_impl.py",
line 392, in _call_hook
    self._subprocess_runner(
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\builders\base.py", line
281, in subprocess_runner
    return log_subprocessor(cmd, cwd, extra_environ=env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Roaming\pdm\venv\Lib\site-packages\pdm\builders\base.py", line
128, in log_subprocessor
    raise build_error(e) from None
pdm.exceptions.BuildError: Build backend raised error: Module 'pkg_resources' is missing,
please make sure it is specified in the 'build-system.requires' section. If it is not
possible, add it to the project and use '--no-isolation' option.
Showing the last 10 lines of the build output:
           ^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\username\AppData\Local\Temp\pdm-build-env-ohhgod5o-shared\Lib\site-packages\setuptools
\build_meta.py", line 333, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\username\AppData\Local\Temp\pdm-build-env-ohhgod5o-shared\Lib\site-packages\setuptools
\build_meta.py", line 301, in _get_build_requires
    self.run_setup()
  File
"C:\Users\username\AppData\Local\Temp\pdm-build-env-ohhgod5o-shared\Lib\site-packages\setuptools
\build_meta.py", line 317, in run_setup
    exec(code, locals())
  File "<string>", line 6, in <module>
ModuleNotFoundError: No module named 'pkg_resources'

  0:00:03 ✖ Some package operations failed. 1/1
See C:\Users\username\AppData\Local\pdm\pdm\Logs\pdm-install-fkmjjsoh.log for detailed debug
log.
[InstallationError]: Some package operations failed.
WARNING: Add '-v' to see the detailed traceback

To reproduce

Do as I've done above.

Expected Behavior

pdm install should install oracledb.

Environment Information

$ pdm info
PDM version:
  2.26.7
Python Interpreter:
  C:\Users\username\test\.venv\Scripts\python.exe (3.12)
Project Root:
  C:/Users/username/test
Local Packages:
  C:\Users\username\test\.venv\Lib\site-packages
$ pdm info --env
{
  "implementation_name": "cpython",
  "implementation_version": "3.12.5",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "11",
  "platform_system": "Windows",
  "platform_version": "10.0.26200",
  "python_full_version": "3.12.5",
  "platform_python_implementation": "CPython",
  "python_version": "3.12",
  "sys_platform": "win32"
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions