-
Notifications
You must be signed in to change notification settings - Fork 247
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
Repairing Windows wheels #459
Comments
One thing which I have not yet understood, is if My idea for repairing under msys2 is to run ldd on the compiled C++/Python .dll and copy all matching /mingw64/bin dll files into a directory, which then would be included within the wheel and if needed loaded again at module import time. |
I have read a bit through related https://github.com/joerick/cibuildwheel/blob/master/cibuildwheel/windows.py and https://github.com/joerick/cibuildwheel/blob/master/examples/github-minimal.yml already. |
You might want to have a look at https://discuss.python.org/t/delocate-auditwheel-but-for-windows/2589 |
Hello yes I had found that discussion exactly as well and the last
commenting person Vinayak Mehta created a script named wheel_repair.py and
leveraging machomangler for repairing windows wheels
<https://github.com/vinayak-mehta/pdftopng/blob/6e4a9d589228f66dfbb6f0197740b0b7c1bef9b3/scripts/wheel_repair.py>
where there the dependent dlls that get inserted into the wheel are even
renamed to avoid conflicts with same named preinstalled dll on any target
install.
One issue is that this script is not yet a separate python package for
example, it is in the middle of a pdf2png project.
so 7. 11. 2020 v 12:11 odesílatel Matthieu Darbois <[email protected]>
napsal:
… You might want to have a look at
https://discuss.python.org/t/delocate-auditwheel-but-for-windows/2589
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJU5QVJM4KF5RJIRMJFHWLSOUTNHANCNFSM4TMU2I6A>
.
|
I will find one solid way to repair hopefully next week, maybe using
wheel_repair.py by @vinayak-mehta and use cibuildwheel to iterate on python
versions.. will keep you posted
so 7. 11. 2020 v 12:28 odesílatel Jonathan-David SCHRODER <
[email protected]> napsal:
… Hello yes I had found that discussion exactly as well and the last
commenting person Vinayak Mehta created a script named wheel_repair.py
and leveraging machomangler for repairing windows wheels
<https://github.com/vinayak-mehta/pdftopng/blob/6e4a9d589228f66dfbb6f0197740b0b7c1bef9b3/scripts/wheel_repair.py>
where there the dependent dlls that get inserted into the wheel are even
renamed to avoid conflicts with same named preinstalled dll on any target
install.
One issue is that this script is not yet a separate python package for
example, it is in the middle of a pdf2png project.
so 7. 11. 2020 v 12:11 odesílatel Matthieu Darbois <
***@***.***> napsal:
> You might want to have a look at
> https://discuss.python.org/t/delocate-auditwheel-but-for-windows/2589
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#459 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAJU5QVJM4KF5RJIRMJFHWLSOUTNHANCNFSM4TMU2I6A>
> .
>
|
The latter; see https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command |
It's not a separate Python package yet because of limitations I mention in vinayak-mehta/pdftopng#3 (comment) I'm open to any feedback you all have about how I could improve it and possibly create a package out of it! I'll keep an eye out on this issue as I'm interested in learning about other ways to build Windows wheels! (since @myselfhimself mentioned about using MSYS2 instead VS)
Yes! I'm using @mayeut @YannickJadoul @joerick and other contributors, thank you for |
Thank you @YannickJadoul for this documentation pointer. So obviously cibuildwheel has no default windows repair wheel command at this time, and its default for the CIBW_REPAIR_WHEEL_COMMAND_WINDOWS environment variable is |
Yep. There's no official PyPA tool either, so I don't think we'll add that before there's an officially supported tool. But you have the possibility to use your own. |
@vinayak-mehta thank you again for posting clear links to related As stated on your png2pdf's issue tracker just now, both your wheel repair |
@vinayak-mehta mentioned here that he sees 2 drawbacks before making his script onto pypa. I think this is really minor. So Vinayak, feel now encouraged twice by @YannickJadoul and me, to release it as a stand alone project, really!! Although this would mean extra maintainer work in the future for you, though it is pure-python, Python 3.x compatible at wide possible and for one OS only. |
Does this mean we can consider your issue solved? (at least the part where this is related to |
https://github.com/vinayak-mehta/pdftopng/blob/355282f57760f0d494b4a36fa5a83ea097cad75b/.github/workflows/build.yml#L16 is a proof that cibuildwheel x wheel repairing x msvc works. If you like to have a clean tracker, then OK, this could be closed. @vinayak-mehta or I could come and reopen the issue or create a new one, when I have msys2 news or he/someone has independent windows wheel repair executable news. |
I have fixed wheel_repair.py for the .dll case (was working for .pyd-based projects already), within the gmic-py project only for now. @vinayak-mehta would you agree, when you have time for it, to create an independent repository for this project, where I co-contribute or make PRs? We could slowly go towards a PyPA module from there, and have it referenced and used by cibuildwheel. |
Just curious: is this mingw/msys-specific? Or would it work for all Windows wheels? |
There are several shipped Python versions on Windows. The Python that is
shipped as an MSYS2 Windows package is compiled using GCC, this is what one
sees when running python (for opening a python shell) or python --version.
Possibly the python.org's python executables are compiled with MSVC.
The wheel_repair.py script uses mostly machomangler
<https://github.com/njsmith/machomachomangler> to repair .dll or .pyd files
and is most probably ABI agnostic in terms of MSVC/MINGW preference,
because it has just been working for my mingw compiled gmic-py module's
.dll, as well as @vinayak-mehta 's MSVC .pyd in the past (if not mistaken).
út 10. 11. 2020 v 20:57 odesílatel Yannick Jadoul <[email protected]>
napsal:
… Just curious: is this mingw/msys-specific? Or would it work for all
Windows wheels?
I still thought mingw isn't supported by Python, though, since Python is
built with MSVC?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJU5QQG7ARJ73BYHT7MLY3SPGLKVANCNFSM4TMU2I6A>
.
|
This all sounds very promising! The world of Windows DLLs is somewhat foreign to me, so I can't comment on the technical aspects but I'd be happy to include such a Windows repair command in cibuildwheel, perhaps after a trial period where we recommend it in the documentation. |
Yes such a trial period would be good, so that this windows wheel repair
project gets known and improved thanks to feedback despite possible
hiccups. ( I do not want to speak in the name of @vinayak-mehta who is the
author though).
I have had a look at how repaired wheels are in terms of intial and final
file trees for Linux, MacOS and Windows. It seems that there is no uniform
way of storing third-party shared libraries (ie. in a same or subdirectory
as the main .so/.dylib/.dll/.pyd). Only the relinker establishes this at
repair time, and sometimes the .dist-info directory's RECORD file lists the
related packed shared libraries paths and hashes, sometimes it only lists the main
module's library (or "portable executable" ie .so .dll or .pyd).
I am trying to understand how cibuildwheel cross-platform compatible
projects need to be configured generally before wheel build time and wheel
repair time (any kind of setup.py code to keep track of third party shared
libraries or some rootlevel directory for shared libraries)...
|
For Linux and MacOS I need to properly set LD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH to be possible to find all external libraries than auditwheel or deallocate collect all dependencies to hidden directory inside wheel (with flat structure) You could see here my code for build |
I would like to see this get officially endorsed by PyPA, though, before |
I am dropping the msys2 idea for now... it seems like a python executable compiled with msvc will not import any of the mingw32 python .dll module I compile. |
I happened to come across this today... looks very new but quite interesting :) https://pypi.org/project/delvewheel/ https://github.com/adang1345/delvewheel @adang1345 |
Very very good, thanks!! I will test it within less than 2 months
hopefully, after recompiling gmic-py for Windows with MSVC :) (busy)
pá 15. 1. 2021 v 15:20 odesílatel Joe Rickerby <[email protected]>
napsal:
… I happened to come across this today... looks very new but quite
interesting :) https://pypi.org/project/delvewheel/
https://github.com/adang1345/delvewheel @adang1345
<https://github.com/adang1345>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJU5QWHN4T6NUIUCHRBQTTS2BFMVANCNFSM4TMU2I6A>
.
|
I test delvewheel for build python-snappy. It looks like it works nice, but have two limitations:
|
Thank you for your very good feedback!
út 2. 2. 2021 v 17:47 odesílatel Grzegorz Bokota <[email protected]>
napsal:
… I test delvewheel for build python-snappy. It looks like it works nice,
but have two limitations:
- need at least python 3.6, so approach from delocate (install in each
environment) could not be used because of python 2.7 and 3.5 .
- need to be executed from same architecture as fixed wheel. (32 bits
python interpreter for 32 bits wheel).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJU5QRGJAT6JWLFYRLYL6DS5AUBRANCNFSM4TMU2I6A>
.
|
@minrk mentioned that pyzmq uses delvewheel on a Python Bytes episode. I wonder if it's time to consider making it our default? Pyzmq use it like: CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
delvewheel repair
-v
--add-path=C:/libzmq-dll
--no-dll=vcruntime140.dll
--wheel-dir={dest_dir}
{wheel} Which is actually requiring a few extra options that auditwheel or delocate don't need. So maybe that's an argument against a delvewheel default. I admit, I know very little about Windows dynamic linking, but I'd be curious why delvewheel requires options that delocate and auditwheel do not. |
delvewheel developer here. To answer your question, delvewheel can still run without these extra options; these options are there to allow package maintainers to have greater control over the DLLs that are included/excluded and where to find them. Documentation for all the options are at https://github.com/adang1345/delvewheel/blob/master/README.md. |
thanks for chiming in @adang1345! So the goal and the operating principle is very similar to auditwheel then. Would something like More broadly, do you think the project is ready for more widespread usage from cibuildwheel users? It does seem to be pretty solid, but I note that the version is still v0.0.11! :) |
@joerick Regarding the readiness for widespread usage, I'm not sure. |
What about making it a suggestion in the docs for now? |
An enriched windows support github action / workflow example with
delvewheel would be nice... With a "experimental" mention in some code or
doc comment around.
so 13. 3. 2021 v 20:45 odesílatel Henry Schreiner ***@***.***>
napsal:
… What about making it a suggestion in the docs for now? REPAIR_COMMAND_WIN:
"delvewheel repair -w {dest_dir} {wheel}" or such?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJU5QQDRK37MURNW4YWPSLTDOXEFANCNFSM4TMU2I6A>
.
|
I think this makes sense, yes. Adding it by default and expecting users to notice it's experimental by reading the docs might be slightly unrealistic? |
I've added a note about delvewheel in the documentation. Let's revisit this in a few months and think about adding it as a default. |
Hello,
I am attempting to build a wheel for a C++ Python binding of G'MIC with .dll dependents of a wheel file on Windows MSYS2 with Github Actions.
This is for python 3.8 for now. Once I have understood how to "repair" the wheel by including the dependent .dll files into the wheel file, I will proceed to use cibuildwheel most probably. My goal is to iterate on Python versions and use my MSYS2 gcc/g++ and bash commands instead of using Visual Studio.
I will give a count of my progress and struggles using cibuildwheel here. I am already using the latter for MacOS Clang builds (though disabled again for now).
Related to #329 and myselfhimself/gmic-py#5 as well as this gmic-py windows-support pull-request
The text was updated successfully, but these errors were encountered: