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

Is it possible to install pycairo on Windows 10? I installed GTK for Windows, as Cairo apparently comes with it. #329

Open
futuremotiondev opened this issue Aug 29, 2023 · 3 comments

Comments

@futuremotiondev
Copy link

futuremotiondev commented Aug 29, 2023

On Cairo's Download Page, it states that:

Precompiled binaries for Windows platforms can be obtained in a variety of ways.
Since GTK+ 2.8 and newer depends on Cairo, you can have Cairo installed on Win32 as a side-effect of installing GTK+.
You probably want at least the zlib, cairo, and libpng run-time archives (you can search on those strings to find them in the page). That should be it. Just pop libcairo-2.dll, libpng13.dll and zlib1.dll into your working directory or system PATH, and away you go!

GTK's Setup Page gives two setup options:

I went with MSYS2 and it installed correctly.

As Cairo's page mentions: You probably want at least the zlib, cairo, and libpng run-time archives. Can I somehow extract these from my MSYS2 install > Add to system PATH and then be good to go with installing pycairo?

Or should I start over, and install via gvsbuild instead?

If anyone can create a working outline to get pycairo installed and fully functional on Windows, it would be a massive help.

Thanks so much.

Edit:

I don't know what to make of this. I did a search for the three DLLs that Cairo recommended, and I have many different versions of each - the exception being libpng13.dll - of which I have no versions.

Everything64_87PTjeKwOX

Everything64_bG7gngF02p

@lazka
Copy link
Member

lazka commented Oct 2, 2023

As Cairo's page mentions: You probably want at least the zlib, cairo, and libpng run-time archives. Can I somehow extract these from my MSYS2 install > Add to system PATH and then be good to go with installing pycairo?

Yes, but you still need a matching toolchain and headers to build pycairo.

The pycairo wheel on Windows comes with cairo included. Does that work for you? And if not, what do you need?

@futuremotiondev
Copy link
Author

@lazka Still confused. Sorry. In order to install pycairo on Windows 10, what are the steps I need to take? I see the following on the homepage:

Pycairo is a Python module providing bindings for the cairo graphics library. It depends on cairo >= 1.15.10 and works with Python 3.8+ and PyPy3. Pycairo, including this documentation, is licensed under the LGPL-2.1-only OR MPL-1.1.
Installing Pycairo requires cairo including its headers. For more info see "Getting Started".

  1. Looking at this: https://cairographics.org/download/ it says:

Since GTK+ 2.8 and newer depends on Cairo, you can have Cairo installed on Win32 as a side-effect of installing GTK+. For example, see The Glade/GTK+ for Windows Toolkit.
From Daniel Keep (edited by Kalle Vahlman):
Go to official GTK+ for Windows page.

  1. I figured that the second option would be best: Go to official GTK+ for Windows page. I just don't know what version to install, MSYS2, or gvsbuild.

MSYS2 is installed, but I also have Visual Studio 2022 installed. Furthermore, I use both regularly, so it would be nice to have both, honestly.

Also, on the getting started page, it mentions:

Installing Pycairo requires pkg-config and cairo including its headers. Here are some examples on how to install those for some platforms

Unfortunately, there are no installation steps for windows:

    Ubuntu/Debian: sudo apt install libcairo2-dev pkg-config python3-dev
    macOS/Homebrew: brew install cairo pkg-config
    Arch Linux: sudo pacman -S cairo pkgconf
    Fedora: sudo dnf install cairo-devel pkg-config python3-devel
    openSUSE: sudo zypper install cairo-devel pkg-config python3-devel

In the same vein, you also mention:

Yes, but you still need a matching toolchain and headers to build pycairo.

Again, how do I get these installed on Win10?

Lastly, you mention:

The pycairo wheel on Windows comes with cairo included. Does that work for you? And if not, what do you need?

Am I overcomplicating this? Do I just need to do:

pip install pycairo

And everything will work as expected? I'm not trying to compile from source, I just want to install and use the library in one of my VENVs. Furthermore, how does the pycairo wheel get installed? Does that just get installed with pip install pycairo? Or do I need a second command?

Any chance you could give me step-by-step instructions on how to get pycairo installed on Windows 10? I know that's asking a lot, I'm sorry.

I would really appreciate any help you can give.

@lazka
Copy link
Member

lazka commented Oct 3, 2023

pip install pycairo is enough on Windows.

Yeah, the docs are lacking in that regard. Thanks for your detailed feedback, I'll try to improve the docs and keep this issue open until then, so it's not forgotten.

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

No branches or pull requests

2 participants