pdm-project / pdm

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

"pdm sync" fails while building Docker image for an editable dependency #1099

Closed dashsatish closed 2 years ago

dashsatish commented 2 years ago

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

 ---> Running in d2adcad50fc2
Preparing isolated env for PEP 517 build...
Collecting setuptools>=40.8.0
  Using cached setuptools-62.3.2-py3-none-any.whl (1.2 MB)
Collecting wheel
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-62.3.2 wheel-0.37.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Collecting setuptools_pep660
  Downloading setuptools_pep660-0.1.3-py3-none-any.whl (4.1 kB)
Collecting wheel
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting setuptools<61,>=42
  Downloading setuptools-60.10.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 17.4 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools, setuptools_pep660
Successfully installed setuptools-62.3.2 setuptools_pep660-0.1.3 wheel-0.37.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'version_config'
  warnings.warn(msg)
/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
`setuptools.config.parse_configuration` became deprecated.

For the time being, you can use the `setuptools.config.setupcfg` module
to access a backward compatible API, but this module is provisional
and might be removed in the future.

  warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/usr/local/bin/python: No module named pip
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 177, in prepare_metadata_for_build_editable
    hook = backend.prepare_metadata_for_build_editable
AttributeError: module 'setuptools_pep660' has no attribute 'prepare_metadata_for_build_editable'. Did you mean: 'prepare_metadata_for_build_wheel'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
    subprocess.check_call(cmd)
  File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpegiukck7', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 345, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 186, in prepare_metadata_for_build_editable
    whl_basename = build_hook(metadata_directory, config_settings)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools_pep660/__init__.py", line 11, in build_editable
    return setuptools.build_meta._BACKEND._build_with_temp_dir(
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
    self.run_setup()
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 11, in <module>
    setuptools.setup(
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 135, in setup
    ok = dist.parse_command_line()
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 484, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 1070, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 540, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 916, in get_command_class
    self._install_dependencies(ep)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 882, in _install_dependencies
    self.fetch_build_egg(pkg_resources.Requirement(str(req)))
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 907, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
    raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpegiukck7', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
Failed to build package, try parsing project files.
Preparing isolated env for PEP 517 build...
Reusing shared build env: /tmp/pdm-build-env-6pbbsmtz-shared
/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
`setuptools.config.parse_configuration` became deprecated.

For the time being, you can use the `setuptools.config.setupcfg` module
to access a backward compatible API, but this module is provisional
and might be removed in the future.

  warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/usr/local/bin/python: No module named pip
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 177, in prepare_metadata_for_build_editable
    hook = backend.prepare_metadata_for_build_editable
AttributeError: module 'setuptools_pep660' has no attribute 'prepare_metadata_for_build_editable'. Did you mean: 'prepare_metadata_for_build_wheel'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
    subprocess.check_call(cmd)
  File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpgzy7hexw', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 345, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 186, in prepare_metadata_for_build_editable
    whl_basename = build_hook(metadata_directory, config_settings)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools_pep660/__init__.py", line 11, in build_editable
    return setuptools.build_meta._BACKEND._build_with_temp_dir(
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
    self.run_setup()
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 5, in <module>
    setuptools.setup(
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 135, in setup
    ok = dist.parse_command_line()
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 484, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 1070, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 540, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 916, in get_command_class
    self._install_dependencies(ep)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 882, in _install_dependencies
    self.fetch_build_egg(pkg_resources.Requirement(str(req)))
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/dist.py", line 907, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/tmp/pdm-build-env-6pbbsmtz-shared/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
    raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpgzy7hexw', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
Failed to build package, try parsing project files.
Traceback (most recent call last):
  File "/usr/local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 232, in main
    return Core().main(args)
  File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 167, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 162, in main
    f(options.project, options)
  File "/usr/local/lib/python3.10/site-packages/pdm/cli/commands/sync.py", line 33, in handle
    actions.do_sync(
  File "/usr/local/lib/python3.10/site-packages/pdm/cli/actions.py", line 193, in do_sync
    candidates = resolve_candidates_from_lockfile(project, requirements)
  File "/usr/local/lib/python3.10/site-packages/pdm/cli/actions.py", line 140, in resolve_candidates_from_lockfile
    mapping, *_ = resolve(
  File "/usr/local/lib/python3.10/site-packages/pdm/resolver/core.py", line 31, in resolve
    result = resolver.resolve(requirements, max_rounds)
  File "/usr/local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/usr/local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 373, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/usr/local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
  File "/usr/local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 203, in _get_updated_criteria
    for requirement in self._p.get_dependencies(candidate=candidate):
  File "/usr/local/lib/python3.10/site-packages/pdm/resolver/providers.py", line 172, in get_dependencies
    deps, requires_python, _ = self.repository.get_dependencies(candidate)
  File "/usr/local/lib/python3.10/site-packages/pdm/models/repositories.py", line 407, in get_dependencies
    reqs, python, summary = super().get_dependencies(candidate)
  File "/usr/local/lib/python3.10/site-packages/pdm/models/repositories.py", line 70, in get_dependencies
    requirements, requires_python, summary = getter(candidate)
  File "/usr/local/lib/python3.10/site-packages/pdm/models/repositories.py", line 399, in _get_dependencies_from_lockfile
    return self.candidate_info[self._identify_candidate(candidate)]
KeyError: ('custom-middleware', None, 'file:///${PROJECT_ROOT}/deps/custom-middleware', True)

Steps to reproduce

Do a simple docker build in Ubuntu (4.14.246-187.474.amzn2.x86_64) with a local editable dependency as per PDM docs No problem in MacOS though


Actual behavior

Build is failing when pdm sync --clean --verbose is run.

Expected behavior

Docker build must pass

Environment Information

[[package]] name = "custom-middleware" version = "0.0.0" requires_python = ">=3.7" editable = true path = "./deps/custom-middleware" summary = "Custom lib" dependencies = [ "Django>=3.0", "boto3", "djangorestframework>=3.13.*", "fastapi", "newrelic", "pyjwt-rsa<0.4,>=0.3.0", "pyjwt<1.8,>=1.7.1", "python-json-logger>=2.0.1", "pytz", "requests", ]

- pyproject.toml

[project] name = "my-service" version = "1.0" description = "" authors = [ { name = "", email = "" }, ] dependencies = [ "-e ./deps/custom-middleware", "-e ./deps/monitoring", "sentry-sdk>=1.5.12", "requests>=2.27.1", "pyyaml>=6.0", "boto3>=1.23.10", "jsonschema>=3.2.0", "psycopg2==2.9.", "django==3.", "djangorestframework==3.", "django-cors-headers==3.12.", "newrelic==7.10.*", "pySqsListener==0.8.10", "gunicorn==20.1.0", ] requires-python = ">=3.10.4" license = { text = "MIT" }

[tool.pdm] [[tool.pdm.source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [tool.pdm.dev-dependencies] dev = [ "flask", "ipdb", "psycopg2-binary==2.9.*", "pytest", "pytest-django", "pytest-cov", "requests-mock", "moto[all]", "factory-boy", "black", ]

[tool.pdm.scripts] test.cmd = "pytest --cache-clear" test.env_file = ".env"

python.cmd = "python" python.env_file = ".env"

[build-system] requires = ["pdm-pep517"] build-backend = "pdm.pep517.api"


```bash
# Paste the output of `pdm info && pdm info --env` below:
PDM version:        1.15.0
Python Interpreter: /usr/local/bin/python (3.10)
Project Root:       /home/services
Project Packages:   /home/services/__pypackages__/3.10
{
    "implementation_name": "cpython",
    "implementation_version": "3.10.4",
    "os_name": "posix",
    "platform_machine": "x86_64",
    "platform_release": "5.10.76-linuxkit",
    "platform_system": "Linux",
    "platform_version": "#1 SMP Mon Nov 8 10:21:19 UTC 2021",
    "python_full_version": "3.10.4",
    "platform_python_implementation": "CPython",
    "python_version": "3.10",
    "sys_platform": "linux"
}

Any help appreciated!

frostming commented 2 years ago

Can you paste the content of setup.py of custom-middleware, you can redact the secrets if any.

dashsatish commented 2 years ago

Can you paste the content of setup.py of custom-middleware, you can redact the secrets if any.

Here is the content of setup.py.

import os

import setuptools

HERE = os.path.dirname(__file__)
VERSION_FILE = os.path.join(HERE, "VERSION.txt")

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="custom-middleware",
version_config={
    "dev_template": "{tag}.{ccount}",
    "dirty_template": "{tag}.{ccount}",
    "version_file": VERSION_FILE,
    "count_commits_from_version_file": True,
},
setup_requires=["setuptools-git-versioning"],
author="..........",
author_email="............",
description="...............",
long_description=long_description,
long_description_content_type="text/markdown",
url="..............github url..............",
packages=setuptools.find_packages(),
classifiers=[
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
],
python_requires=">=3.7",
install_requires=[
    "pyjwt>=1.7.1,<1.8",
    "pyjwt-rsa>=0.3.0,<0.4",
    "python-json-logger>=2.0.1",
    "fastapi",
    "Django>=3.0",
    "djangorestframework>=3.13.*",
    "boto3",
    "requests",
    "newrelic",
    "pytz",
],
)

This was working in pipenv , I believe shouldn't be a problem in PDM. I also tried out with a python slim-buster image still fails though.

Additionally, this seems to be closed & fixed. Is it released?

dashsatish commented 2 years ago

@frostming Any help on this?

frostming commented 2 years ago

It is not released, but is already fixed on the main branch

dashsatish commented 2 years ago

Can we expect a release this month? I can test build changes if it is done, let me know. BTW what's the release cycle that you follow?

frostming commented 2 years ago

Released https://github.com/pdm-project/pdm/releases/tag/1.15.1

Satish @.***> 于2022年6月2日周四 01:11写道:

Can we expect a release this month? I can test build changes if it is done, let me know. BTW what's the release cycle that you follow?

— Reply to this email directly, view it on GitHub https://github.com/pdm-project/pdm/issues/1099#issuecomment-1143892414, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4UNXUV6SCPWOLGQ2HI6STVM6KVHANCNFSM5XHHFFTQ . You are receiving this because you were mentioned.Message ID: @.***>

dashsatish commented 2 years ago

@frostming I'm still facing an error during the build. Now there is no KeyError because of the fix but there is a disutils error. Let me know if I have downgrade setuptools and to which version specifically?

Step 8/13 : RUN pdm sync --clean --verbose
 ---> Running in ea11e118aa8f
Preparing isolated env for PEP 517 build...
Collecting wheel
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting setuptools>=40.8.0
  Downloading setuptools-62.3.2-py3-none-any.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 21.9 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools
Successfully installed setuptools-62.3.2 wheel-0.37.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Collecting setuptools_pep660
  Downloading setuptools_pep660-0.1.4-py3-none-any.whl (4.1 kB)
Collecting setuptools<61,>=42
  Downloading setuptools-60.10.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 23.3 MB/s eta 0:00:00
Collecting wheel
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, setuptools, setuptools_pep660
Successfully installed setuptools-62.3.2 setuptools_pep660-0.1.4 wheel-0.37.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'version_config'
  warnings.warn(msg)
/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
`setuptools.config.parse_configuration` became deprecated.

For the time being, you can use the `setuptools.config.setupcfg` module
to access a backward compatible API, but this module is provisional
and might be removed in the future.

  warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/usr/local/bin/python: No module named pip
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 177, in prepare_metadata_for_build_editable
    hook = backend.prepare_metadata_for_build_editable
AttributeError: module 'setuptools_pep660' has no attribute 'prepare_metadata_for_build_editable'. Did you mean: 'prepare_metadata_for_build_wheel'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
    subprocess.check_call(cmd)
  File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpoppne2i6', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 345, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 186, in prepare_metadata_for_build_editable
    whl_basename = build_hook(metadata_directory, config_settings)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools_pep660/__init__.py", line 11, in build_editable
    return setuptools.build_meta._BACKEND._build_with_temp_dir(
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
    self.run_setup()
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 11, in <module>
    setuptools.setup(
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 135, in setup
    ok = dist.parse_command_line()
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 484, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 1070, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 540, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 916, in get_command_class
    self._install_dependencies(ep)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 882, in _install_dependencies
    self.fetch_build_egg(pkg_resources.Requirement(str(req)))
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 907, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
    raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpoppne2i6', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
Failed to build package, try parsing project files.
Synchronizing working set with lock file: 135 to add, 0 to update, 0 to remove

Preparing isolated env for PEP 517 build...
Reusing shared build env: /tmp/pdm-build-env-68kjuklj-shared
Building wheel for file:///home/myprojects/deps/custom-middleware#egg=custom-middleware
The build backend doesn't support PEP 660, falling back to setuptools-pep660
/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'version_config'
  warnings.warn(msg)
/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
`setuptools.config.parse_configuration` became deprecated.

For the time being, you can use the `setuptools.config.setupcfg` module
to access a backward compatible API, but this module is provisional
and might be removed in the future.

  warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/usr/local/bin/python: No module named pip
Traceback (most recent call last):
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
    subprocess.check_call(cmd)
  File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpbnuf72qg', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 345, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 283, in build_editable
    return hook(wheel_directory, config_settings, metadata_directory)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools_pep660/__init__.py", line 11, in build_editable
    return setuptools.build_meta._BACKEND._build_with_temp_dir(
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
    self.run_setup()
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 11, in <module>
    setuptools.setup(
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 135, in setup
    ok = dist.parse_command_line()
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 484, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 1070, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 540, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 916, in get_command_class
    self._install_dependencies(ep)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 882, in _install_dependencies
    self.fetch_build_egg(pkg_resources.Requirement(str(req)))
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/dist.py", line 907, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/tmp/pdm-build-env-68kjuklj-shared/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
    raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpbnuf72qg', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
Install custom-middleware 0.0.0 failed
Traceback (most recent call last):
  File "/usr/local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 232, in main
    return Core().main(args)
  File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 167, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 162, in main
    f(options.project, options)
  File "/usr/local/lib/python3.10/site-packages/pdm/cli/commands/sync.py", line 33, in handle
    actions.do_sync(
  File "/usr/local/lib/python3.10/site-packages/pdm/cli/actions.py", line 209, in do_sync
    handler.synchronize()
  File "/usr/local/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 356, in synchronize
    handlers[kind](key)
  File "/usr/local/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 207, in install_candidate
    self.manager.install(can)
  File "/usr/local/lib/python3.10/site-packages/pdm/installers/manager.py", line 39, in install
    installer(prepared.build(), self.environment, prepared.direct_url())
  File "/usr/local/lib/python3.10/site-packages/pdm/models/candidates.py", line 331, in build
    self.wheel = builder.build(build_dir, metadata_directory=self._metadata_dir)
  File "/usr/local/lib/python3.10/site-packages/pdm/builders/editable.py", line 62, in build
    return self.build(out_dir, config_settings, metadata_directory)
  File "/usr/local/lib/python3.10/site-packages/pdm/builders/editable.py", line 53, in build
    filename = self._hook.build_editable(
  File "/usr/local/lib/python3.10/site-packages/pep517/wrappers.py", line 261, in build_editable
    return self._call_hook('build_editable', {
  File "/usr/local/lib/python3.10/site-packages/pep517/wrappers.py", line 322, in _call_hook
    self._subprocess_runner(
  File "/usr/local/lib/python3.10/site-packages/pdm/builders/base.py", line 238, in subprocess_runner
    return log_subprocessor(cmd, cwd, extra_environ=env)
  File "/usr/local/lib/python3.10/site-packages/pdm/builders/base.py", line 86, in log_subprocessor
    raise BuildError(
pdm.exceptions.BuildError: Call command ['/usr/local/bin/python', '/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py', 'build_editable', '/tmp/tmpb61629ke'] return non-zero status(1).
The command '/bin/sh -c pdm sync --clean --verbose' returned a non-zero code: 1
dashsatish commented 2 years ago

Additionally, I also get KeyError (#1101 ) when the version comes out to be 2.6.2.13 like below:

KeyError: ('custom-middleware', '2.6.2', 'file:///${PROJECT_ROOT}/deps/custom-middleware', False)

Can this be fixed?

frostming commented 2 years ago

It is a tricky one but I afterall worked out with a fix, would you please test the branch to see if it works fine? much thanks