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

Provide Windows Wheels #19

Closed
lazka opened this issue Apr 18, 2017 · 19 comments · Fixed by #197
Closed

Provide Windows Wheels #19

lazka opened this issue Apr 18, 2017 · 19 comments · Fixed by #197

Comments

@lazka
Copy link
Member

lazka commented Apr 18, 2017

ebassi suggested it and has some example code here: https://github.com/anholt/libepoxy/blob/master/.appveyor.yml

@stuaxo
Copy link
Collaborator

stuaxo commented Apr 18, 2017

I was thinking along the same lines - only didn't open a ticket as I'm not going to have any free time starting in about 2 weeks.

This is definitely a way forward if we want .WHL builds, using VS (which we do, since Python built with MingW is not compatible with the default VS built python when it comes to binary modules like PyCairo).

@lazka
Copy link
Member Author

lazka commented Apr 18, 2017

Thanks. Any help appreciated.

If mingw builds are easier, they still can help prevent general Windows build/test breakage for starters.

For MSVC builds and wheels etc I'm wondering who would be installing them? Would a cairo build be required and where would you get one? Should cairo be bundled in the wheel somehow?

@stuaxo
Copy link
Collaborator

stuaxo commented Apr 18, 2017

Starting with mingw builds definitely makes sense, if it's too much hassle now then adding MSVC to appveyor later is a definite possibility.

I think the wheel contains the _cairo.pyd, which is pycairo + cairo (have a look at the mingw build on http://www.lfd.uci.edu/~gohlke/pythonlibs/ and older non WHL builds for MSVC.)

I looked at _cairo.pyd in a resource viewer a while ago and it looked like it had all the cairo symbols, also the 1.3MB size seemed right for pycairo including cairo.

Potential users are anyone on the default build of python on windows with an interest in pycairo, there are bits of code on the net for combining it with pygame, pyglet and other gaming engines for a start.

@lazka
Copy link
Member Author

lazka commented Apr 19, 2017

OK, sounds good!

lazka added a commit to lazka/pycairo that referenced this issue May 8, 2017
Tests things under msys2
lazka added a commit that referenced this issue May 8, 2017
Tests things under msys2
@lazka
Copy link
Member Author

lazka commented May 8, 2017

I've added some mingw test jobs

@lazka
Copy link
Member Author

lazka commented Sep 6, 2017

Some things I've found:

@lazka lazka changed the title Look into appveyor Provide Windows Wheels Dec 2, 2017
@lazka
Copy link
Member Author

lazka commented Dec 2, 2017

Short status update:

  • We use the DLL from https://github.com/preshing/cairo-windows to test the msvc build on appveyor
  • Some tests are skipped with it (search for "msvc fixme"), maybe due to the cairo dll including the runtime, but it should link against the runtime used by Python. Also the DLL doesn't enable all features (tee surface for example)

Todo:

@flowerbug
Copy link

flowerbug commented Jan 13, 2019

I can +1 this effort as my pyglet game would like an easier way for people to use it without having to install a C compiler.

(if you were wondering who would use the results of this)

at present i don't have a Windows machine to test on or a MacOS but would be happy to have wheels for both available so when someone goes to install my game from PyPI it pulls in the binary wheels for pygobject/pycairo.

@grst
Copy link

grst commented Jun 4, 2020

Having the precompiled wheel would also be extremely useful when setting up pycairo dependencies for GitHub actions on windows ;)

So far I've been using https://www.lfd.uci.edu/~gohlke/pythonlibs/, but the URLs seem to change every once in a while.

@christopherhesse
Copy link

christopherhesse commented Jun 12, 2020

I think it would be great if pycairo had wheels available for linux, mac, and windows and would greatly increase the usability.

Right now I can't add pycairo as a dependency for my python package because I believe it would cause install failures for users that don't have a C compiler and the cairo shared library installed.

Now that Github Actions offers free linux/mac/windows workers, it should be much easier to create binary wheels. I maintain a package that builds wheels for linux/mac/windows (still using travis for now): https://github.com/openai/procgen/blob/master/.travis.yml and it's great for the user experience and reduces the number of issues filed about installation failures.

cibuildwheel now supports github actions so it should be fairly easy to setup: https://cibuildwheel.readthedocs.io/en/stable/setup/#github-actions

@lazka any thoughts on this?

@naveen521kk
Copy link
Contributor

naveen521kk commented Jun 29, 2020

I think it is quite important to create windows binaries at least as they don't have C compilers installed by default. For that, setting up a CI is good. Also, I tried compiling it on Travis and install the binaries on my computer. I installed it successfully but on running the example I get the below error.
intallerr

Also, I just found a small fix for it. Looks like cairo.dll should be in the package directory. Did I do anything wrong? You could see https://github.com/naveen521kk/pycairo/blob/master/.travis.yml. Also using Travis doesn't seem that useful as it doesn't have 32-bit windows which would b required for 32-bit users.

@christopherhesse
Copy link

christopherhesse commented Jun 29, 2020

Using github actions + cibuildwheel makes this pretty easy, mostly just copying and pasting the example file, see this other python project: ICRAR/crc32c#16

@naveen521kk
Copy link
Contributor

Maybe something is missing out in setup.py in windows build. It forget to include the cairo.dll in the package. Just checking if I am correct. Or help me in fixing it.

@naveen521kk
Copy link
Contributor

Using github ations + cibuildwheel makes this pretty easy, mostly just copying and pasting the example file, see this other python project: ICRAR/crc32c#16

I tried and it @christopherhesse The problem with that was it needs seperate compiled Cairo for 32 bit and 64 bit PC. So this creates some problems. Need to check it. Maybe it doesn't support it. Idk.

@christopherhesse
Copy link

What's the issue with that? Can't you have one folder with the cairo dll for 32 bit and another with the 64 bit and then copy it to the correct place before packaging?

@naveen521kk
Copy link
Contributor

What's the issue with that? Can't you have one folder with the cairo dll for 32 bit and another with the 64 bit and then copy it to the correct place before packaging?

That causes quite a lot of problems. Because 32-bit is compatible with 32-bit os only likewise 64-bit.

@christopherhesse
Copy link

I'm not sure that's accurate, there are wheels here for windows: https://www.lfd.uci.edu/~gohlke/pythonlibs/ 32 bit and 64 bit, and each one has a cario.dll in it. I presume that the packager copied the correct DLL into the package folder before creating the wheel.

@naveen521kk
Copy link
Contributor

naveen521kk commented Jul 2, 2020

I'm not sure that's accurate, there are wheels here for windows: https://www.lfd.uci.edu/~gohlke/pythonlibs/ 32 bit and 64 bit, and each one has a cario.dll in it. I presume that the packager copied the correct DLL into the package folder before creating the wheel.

I just find the way to do it without using cibuildwheel for windows using Travis. I downloaded it to my PC and the script in ran without any error. @christopherhesse I just don't know how to proceed with linux nor Mac.

@naveen521kk
Copy link
Contributor

Yes this issue is fixed and can be closed #191
cc
@stuaxo @lazka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants