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

PackageFinder.find_requirement always fallback to sdist because being given the wrong ABI tag #378

Closed
1 task done
linw1995 opened this issue Apr 4, 2021 · 3 comments · Fixed by #379
Closed
1 task done
Labels
🐛 bug Something isn't working

Comments

@linw1995
Copy link
Member

linw1995 commented Apr 4, 2021

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

Steps to reproduce

  1. For example, use the Py3.9 to install PDM
  2. use PDM to set up a project with Py3.9
  3. execute pdm add lxml to install lxml via wheel installation.
  4. use PDM to switch Python executable to Py3.8. pdm use -f 3.8
  5. execute pdm sync -v to install lxml

Actual behavior

It installs lxml via compiling from source unlike the previous case although lxml has prebuilt wheels with Py3.8.

Expected behavior

It installs lxml via wheel installation.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:        1.5.0b1.dev12+gd48c6d3
Python Interpreter: /usr/bin/python3 (3.8.2)
Project Root:       /private/tmp/lxml
Project Packages:   /private/tmp/lxml/__pypackages__/3.8
{
  "implementation_name": "cpython",
  "implementation_version": "3.8.2",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "20.3.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64",
  "python_full_version": "3.8.2",
  "platform_python_implementation": "CPython",
  "python_version": "3.8",
  "sys_platform": "darwin"
}

Hotfix

I find out what causes this problem. The get_abi_tag function from pdm.models.pip_shims is executed by the Python interpreter of PDM instead of the interpreter which we have chosen.

linw1995@f4fb1ea

This commit works well with most kinds of Python interpreters. But the better way is executing the whole get_abi_tag function by the interpreter we want. To do this, we may need to endure installing extras dependencies like the wheel package. But it is possible we are able to move the codes which we need from the wheel package into the PDM package.

@linw1995 linw1995 added the 🐛 bug Something isn't working label Apr 4, 2021
@frostming
Copy link
Collaborator

Let me clarify the root cause, what exact part makes the wheel doesn't match for Py 3.8? soabi, impl, python_version, or the d, m, u flags?

@linw1995
Copy link
Member Author

linw1995 commented Apr 5, 2021

PDM with Py3.9 gets soabi = 'cp39' and it uses this to find packages for the Py3.8 environment.

@frostming
Copy link
Collaborator

frostming commented Apr 6, 2021

Oh, I wasn't aware of that, I never print that value on macos and it is empty on Windows. :(

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