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

PDM installs wrong architecture of pywin32 wheel on Windows #2464

Closed
1 task done
p-rogalski opened this issue Dec 5, 2023 · 0 comments · Fixed by #2467
Closed
1 task done

PDM installs wrong architecture of pywin32 wheel on Windows #2464

p-rogalski opened this issue Dec 5, 2023 · 0 comments · Fixed by #2467
Assignees
Labels
🐛 bug Something isn't working

Comments

@p-rogalski
Copy link
Contributor

p-rogalski commented Dec 5, 2023

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

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

Steps to reproduce

  1. Use following minimal pyproject.toml:

    [build-system]
    requires = ["pdm-backend"]
    build-backend = "pdm.backend"
    
    [project]
    name = "my-package"
    version = "0.0.1"
    requires-python = ">=3.10,<4.0"
    dependencies = ["pywin32>=306"]
  2. Create 32 bit venv (e.g. pdm venv create --with-pip 3.12-32)

  3. Create the lock file (pdm lock)

  4. Install project (pdm install -v):

    Output
    STATUS: Resolving packages from lockfile...
    STATUS: Fetching hashes for resolved packages...
    unearth.preparer: The file . is a local directory, use it directly
    Synchronizing working set with resolved packages: 1 to add, 0 to update, 0 to remove
    
    unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/83/1c/25b79fc3ec99b19b0a0730cc47356f7e2959863bf9f3cd314332bddb4f68/pywin32-306-cp312-cp312-win_amd64.whl (from https://pypi.org/simple/pywin32/)>
    ✔ Install pywin32 306 successful
    Installing the project as an editable package...
    pdm.termui: Preparing environment(Isolated mode) for PEP 517 build...
    pdm.termui: Running PEP 517 backend to build a wheel for <Link file:///F:/pywin32-test (from None)>
    pdm.termui: ======== Start resolving requirements ========
    pdm.termui:   pdm-backend
    pdm.termui:   python>=3.12,<3.12.1
    pdm.termui:   Adding requirement pdm-backend
    pdm.termui:   Adding requirement python>=3.12,<3.12.1
    pdm.termui: ======== Starting round 0 ========
    pdm.termui: Pinning: python None
    pdm.termui: ======== Ending round 0 ========
    pdm.termui: ======== Starting round 1 ========
    pdm.termui: Pinning: pdm-backend 2.1.7
    pdm.termui: ======== Ending round 1 ========
    pdm.termui: ======== Starting round 2 ========
    pdm.termui: ======== Resolution Result ========
    pdm.termui: Stable pins:
    pdm.termui:        python None
    pdm.termui:   pdm-backend 2.1.7
    pdm.termui: Installing pdm-backend@2.1.7...
    unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/38/d8/0a932c1172645bebcd379ea0604a5db50b0410888fa8c5fe56b0ea12d87c/pdm_backend-2.1.7-py3-none-any.whl (from https://pypi.org/simple/pdm-backend/)>
    pdm.termui: Synchronization complete.
    pdm.termui: ======== Start resolving requirements ========
    pdm.termui:   editables
    pdm.termui:   python>=3.12,<3.12.1
    pdm.termui:   Adding requirement editables
    pdm.termui:   Adding requirement python>=3.12,<3.12.1
    pdm.termui: ======== Starting round 0 ========
    pdm.termui: Pinning: python None
    pdm.termui: ======== Ending round 0 ========
    pdm.termui: ======== Starting round 1 ========
    pdm.termui: Pinning: editables 0.5
    pdm.termui: ======== Ending round 1 ========
    pdm.termui: ======== Starting round 2 ========
    pdm.termui: ======== Resolution Result ========
    pdm.termui: Stable pins:
    pdm.termui:      python None
    pdm.termui:   editables 0.5
    pdm.termui: Installing editables@0.5...
    unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/6b/be/0f2f4a5e8adc114a02b63d92bf8edbfa24db6fc602fca83c885af2479e0e/editables-0.5-py3-none-any.whl (from https://pypi.org/simple/editables/)>
    pdm.termui: Synchronization complete.
    pdm.termui: C:\Users\P291F~1.ROG\AppData\Local\Temp\pdm-build-env-akd7_251-shared\Lib\site-packages\pdm\backend\wheel.py:226: PDMWarning: No license files are matched with glob patterns ['LICENSES/*', 'LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*'].
    pdm.termui:   for file in self.find_license_files():
    pdm.termui:  - Adding .pdm-build\.gitignore -> .gitignore
    pdm.termui:  - Adding .pdm-build\my_package-0.0.1+editable.dist-info\METADATA -> my_package-0.0.1+editable.dist-info/METADATA
    pdm.termui:  - Adding .pdm-build\my_package-0.0.1+editable.dist-info\WHEEL -> my_package-0.0.1+editable.dist-info/WHEEL
    pdm.termui:  - Adding .pdm-build\my_package.pth -> my_package.pth
    pdm.termui:  - Adding my_package-0.0.1+editable.dist-info\RECORD -> my_package-0.0.1+editable.dist-info/RECORD
    ✔ Install my-package 0.0.1 successful
    
    🎉 All complete!
    
  5. Try to import a pywin32 module, e.g. pythoncom

Actual behavior

A 64-bit wheel of pywin32 is installed into the 32-bit venv (see pdm install -v output). This produces the following error when trying to import e.g. pythoncom:

Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 12:49:59) [MSC v.1935 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pythoncom
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\pywin32-test\.venv\Lib\site-packages\pythoncom.py", line 2, in <module>
    import pywintypes
  File "F:\pywin32-test\.venv\Lib\site-packages\win32\lib\pywintypes.py", line 126, in <module>
    __import_pywin32_system_module__("pywintypes", globals())
  File "F:\pywin32-test\.venv\Lib\site-packages\win32\lib\pywintypes.py", line 52, in __import_pywin32_system_module__
    import _win32sysloader
ImportError: DLL load failed while importing _win32sysloader: %1 is not a valid Win32 application.

Expected behavior

A 32-bit wheel of pywin32 should be installed into the 32-bit venv.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.10.4
Python Interpreter:
  F:\pywin32-test\.venv\Scripts\python.exe (3.12-32)
Project Root:
  F:/pywin32-test
Local Packages:
  
{
  "implementation_name": "cpython",
  "implementation_version": "3.12.0",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "11",
  "platform_system": "Windows",
  "platform_version": "10.0.22621",
  "python_full_version": "3.12.0",
  "platform_python_implementation": "CPython",
  "python_version": "3.12",
  "sys_platform": "win32"
}
@p-rogalski p-rogalski added the 🐛 bug Something isn't working label Dec 5, 2023
@frostming frostming self-assigned this Dec 7, 2023
frostming added a commit that referenced this issue Dec 7, 2023
Fixes #2464

Signed-off-by: Frost Ming <me@frostming.com>
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