Skip to content
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

Dependency with additional headers fails to install #2573

Closed
1 task done
ossimoi opened this issue Jan 18, 2024 · 2 comments · Fixed by #2576
Closed
1 task done

Dependency with additional headers fails to install #2573

ossimoi opened this issue Jan 18, 2024 · 2 comments · Fixed by #2576
Assignees
Labels
🐛 bug Something isn't working

Comments

@ossimoi
Copy link

ossimoi commented Jan 18, 2024

  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

Include greenlet in project dependencies. Run pdm install.

`Traceback (most recent call last):
  File "/home/user/project/.venv/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/core.py", line 288, in main
    return Core().main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/core.py", line 208, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/core.py", line 203, in main
    self.handle(project, options)
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/core.py", line 157, in handle
    command.handle(project, options)
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/cli/commands/install.py", line 100, in handle
    actions.do_sync(
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/cli/actions.py", line 237, in do_sync
    synchronizer.synchronize()
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 386, in synchronize
    to_add, to_update, to_remove = self.compare_with_working_set()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 217, in compare_with_working_set
    candidates = self.candidates.copy()
                 ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 152, in candidates
    if self.should_install_editables():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 170, in should_install_editables
    metadata = self.self_candidate.prepare(self.environment).metadata
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 140, in self_candidate
    return self.environment.project.make_self_candidate(not self.no_editable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/project/core.py", line 505, in make_self_candidate
    can.prepare(self.environment).metadata
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/models/candidates.py", line 605, in metadata
    result = self.prepare_metadata()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/models/candidates.py", line 512, in prepare_metadata
    return self._get_metadata_from_build(self._unpacked_dir, metadata_parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/models/candidates.py", line 587, in _get_metadata_from_build
    self._metadata_dir = builder(source_dir, self.environment).prepare_metadata(metadata_parent)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/builders/editable.py", line 21, in prepare_metadata
    self.install(self._requires, shared=True)
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/builders/base.py", line 298, in install
    install_requirements(missing, env)
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/core.py", line 30, in install_requirements
    syncer.synchronize()
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 256, in synchronize
    manager.install(can)
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/manager.py", line 34, in install
    dist_info = installer(str(prepared.build()), self.environment, prepared.direct_url())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/installers.py", line 199, in install_wheel
    return _install_wheel(wheel=wheel, destination=destination, additional_metadata=additional_metadata)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/installers.py", line 312, in _install_wheel
    install(source, destination, additional_metadata=additional_metadata or {})
  File "/home/user/project/.venv/lib/python3.11/site-packages/installer/_core.py", line 109, in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/installer/destinations.py", line 207, in write_file
    return self.write_to_fs(scheme, path_, stream, is_executable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/pdm/installers/installers.py", line 167, in write_to_fs
    return super().write_to_fs(scheme, path, stream, is_executable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/.venv/lib/python3.11/site-packages/installer/destinations.py", line 173, in write_to_fs
    with open(target_path, "wb") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/usr/include/python3.11/greenlet.h'
# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.12.1
Python Interpreter:
  /home/user/project/.venv/bin/python (3.11)
Project Root:
  /home/user/project

Happens when pdm is installed in either system or venv. pip install greenlet works.

@ossimoi ossimoi added the 🐛 bug Something isn't working label Jan 18, 2024
@frostming
Copy link
Collaborator

What's the output of /home/user/project/.venv/bin/python -m sysconfig?

@ossimoi
Copy link
Author

ossimoi commented Jan 19, 2024

What's the output of /home/user/project/.venv/bin/python -m sysconfig?

Platform: "linux-x86_64"
Python version: "3.11"
Current installation scheme: "venv"

Paths:
        data = "/home/user/project/.venv"
        include = "/usr/include/python3.11"
        platinclude = "/usr/include/python3.11"
        platlib = "/home/user/project/.venv/lib/python3.11/site-packages"
        platstdlib = "/home/user/project/.venv/lib/python3.11"
        purelib = "/home/user/project/.venv/lib/python3.11/site-packages"
        scripts = "/home/user/project/.venv/bin"
        stdlib = "/usr/lib/python3.11"

I assume include dir is wrong? If you need the full list of vars provided by sysconfig I'll pastebin it.

@frostming frostming self-assigned this Jan 19, 2024
frostming added a commit that referenced this issue Jan 19, 2024
frostming added a commit that referenced this issue Jan 19, 2024
…gned-off-by: Frost Ming <[email protected]>

* fix: Dependency with additional headers fails to install
Fixes #2573

Signed-off-by: Frost Ming <[email protected]>
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
Development

Successfully merging a pull request may close this issue.

2 participants