Open gijzelaerr opened 3 years ago
There is nothing macos specific in pycairo. Maybe your pip is confused, try pip cache purge
seems to have the same result: https://gist.github.com/gijzelaerr/57d58be34d9f98fb3dcc1e82242b6312
thanks. the one thing that changed in 1.20 is that I opted pycairo into "PEP 517" by adding a pyproject.toml file to the package. I guess this triggers some bug in pip your case.
No idea right now, sorry.
There are also some arm64 warnings in there. are you on arm64?
nope, just a normal x86_64 OSX 10.15. I guess the osx toolchain is already preparing the binaries for the upcoming switch to arm arch.
ok. The only related error I can find is https://old.reddit.com/r/vscode/comments/iwoh5d/help_error_in_installing_pylint_in_virtual/ which isn't that helpful.
Maybe updating python in homebrew would help (the errors suggest it was installed with an older macos version).
And consider filing a bug with wheel: https://github.com/pypa/wheel Maybe they know more.
Interesting, If I use python 3.9.0 using pyenv the problem goes away. So yes, I guess it is some odd issue in combination with the vanilla python 3.8 bundled with OS X 10.15 and wheel / pip.
I'm curious: why are there no macOS wheels for the latest release on PyPI?
@justvanrossum probably some extra work needs doing here - WHL support was getting added, at around the same time travis decided to start charging + everything had to move to github actions.
If I remember correctly there will be a wheel with the next release of pycairo.
Not for macOS though? Maybe if you want macOS wheels, it is easy to build(at least I can help) it but you would need to convince @lazka for that.
@naveen521kk If you want help reviewing a PR I'm up for that, though even more time starved than last time :)
I've been away from this long enough to have forgotten what the status of WHLs is here :-/
The problem is that wheels would break pygobject (then there would be two different libcairo in the same process), so I'm not that enthusiastic about it. But I guess pycairo has more users...
No wheels, no painless installation, no happy users. I've honestly been avoiding pycairo because it's such a pain to get installed reliably across platforms. Not every Python user has (the right) development tools installed to build from the sources. (In my circles most do not.)
This is something at the edge of my knowledge, is it that if a library is contained in a whl and the system with the same name there is a clash and an issue of which to choose ?
Could we do some mangling of the name when it comes to the one we put in the whl, so we at least have some control over which we choose ?
@lazka Maybe we can upload wheel to the releases section and not to PyPi. User's can install from there if needed and I don't think pip will ever find it. So I think there wont be any problem with pygobject though.
@stuaxo Python handles it. First, priority for loading the library is for the .libs
in the wheel. Atleast that is so on unixish OS. This isn't so for windows though, but the first one loaded will be in the same directory, so the wheels do work on windows.
Also, lazka, does pygobject link with pycairo or directly with cairo itself? Because if we statically link the produced output and if pygobject simply links with pycairo there won't be any problem I think.
Again, @lazka does pygobject links with pycairo directly or with Cairo? If we link statically with cairo will pygobject just use the one from pycairo?
pygobject links against both pycairo and cairo.
pygobject queries for pkg-config right? So what if we create those accordingly? such that it doesn't link directly to cairo. and we create wheels where we link to cairo statically?
pygobject gets cairo pointers from gtk and passes them to pycairo and vice versa. I don't think pkg-config is relevant here.
Ok, then nothing can be done to make it work with the wheels provided right? Then I think wheels can be build but not uploaded to PyPI, instead just kept in the releases section, and have a mention of it in the installation section.
Then I think wheels can be build but not uploaded to PyPI, instead just kept in the releases section, and have a mention of it in the installation section.
Then projects can't depend on pycairo automatically, making their CI cumbersome, and making it impossible to install such a project seamlessly with pypi.
I have no clue about the problems that cause this and how to solve them, I'd just like to point out the obvious: that this would be a very sad situation for pycairo indeed.
Maybe upload wheels to testpypi? I could understand the problems with pygobject, yes I don't know a way to fix it though. I at first thought it doesn't link to Cairo directly, instead, it just links to pycairo, which inturn will link to Cairo. If that's the case if we have wheels statically linked to Cairo, then pygobject doesn't need to link with Cairo, instead just linking with pycairo will suffice and the .pc
file pycairo generates will also be changed according.
But I don't think that is the case as @lazka told.
Having two different versions of Cairo installed would create a lot of problems...
Rather I would like to have it only in specific condition only when the users need it, the wheels should be used. Or maybe a new pypi package for wheels, but I still don't know which should be the best.
On the other side on Windows, this wasn't a problem at all. pygobject
can't be directly installed there, it needs MSYS2 project, so there were no problems creating a wheel.
This isn't the only library that's had the issue of wanting to use libraries that may clash with system libraries.
There was some discussion around this for auditwheel here https://discuss.python.org/t/delocate-auditwheel-but-for-windows/2589/8
Dealocate looks like a tool that aims to solve clashes with system libraries on mac, maybe it can solve that part of the problem for us: https://pypi.org/project/delocate/
EDIT: Since we mentioned windows, there is a similar tool: https://pypi.org/project/delvewheel/ [/EDIT]
I have to admit to getting a little confused every time I re-visit this ticket, it might be useful to make a table of the different scenarios.
I don't think that solves the problem of two different Cairo instance and the compatibility between the two.
To get on the same page, what are the different versions that may clash ?
Lets assume homebrew the user is on OSX with homebrew + we didn't know about this issue and had WHLs for pycairo and pygobject.
Is this a reasonable list of the cairo libs that could clash ?
cairo installed via homebrew cairo that was installed as part of the pycairo whl cairo that was installed as part of the pygobject whl
(And lets assume they are all different, so either different versions or different compilation options)
Well, what pygobject does is pick the pointer from gtk and give it to pycairo. The pointer can be incompatible if gtk was compiled under different Cairo(either version or compilation options) and could cause Segmentation Faults. And this is the main reason why @lazka is hesitant to build wheels.
I'm totally onboard with being cautious.
Is this for any use of pygobject, or only when doing something like drawing with cairo in Gtk ?
What's the smallest amount of code that will show us things are broken, is it simply import gi
or do we need to do something more?
I might be able to give you remote access to a mac to try and create the breaking scenarios and see if deallocate
can help.
Maybe rather than simply an import statement run the example at https://pygobject.readthedocs.io/en/latest/guide/cairo_integration.html
I know this thread is quite a few months old at this point (not sure if it's best to just continue this thread for my question or start a new one; I'm gonna guess the former), but I'm wondering: has there been any decision made as to whether a .whl
file will be provided anywhere for MacOS, whether that be on PyPI, TestPyPI, or the Releases page?
I work with an online high school CS education organization, and we have our own Python graphics package that depends on pycairo. At the moment, we're stuck with "installing" the package using a giant zip file with a bunch of different versions of our dependencies (including pycairo) that get loaded in depending on what OS you run the package on. It works, but it's definitely not the most convenient thing in the world. I've been working for a couple months on adding it to PyPI and having it install packages directly so the process is a lot smoother and the package is a lot less bulky.
While the install works fine on Windows, there are error messages on MacOS if you don't install cairo with brew
or another package manager first. However, we'd like to allow our users on Mac to pip install our graphics package without needing to install Homebrew on their system or use some other package manager. We ideally want the installation process to be one simple command, especially since some of our users are high school students who may not be super familiar with cmd/terminal. But we'd need wheels for pycairo on MacOS in order to do that, at least as far as I know. That being said, is there any place we can access such a file either now or sometime in the near future? Even if it's not available on the main PyPI site, having it available on TestPyPI or anywhere else that pip can access would be really useful for us (and I'm sure other people developing packages that depend on pycairo, too).
This issue was fixed for me by specifying a MACOSX_DEPLOYMENT_TARGET
version using the following command.
MACOSX_DEPLOYMENT_TARGET=10.3 pip3 install pycairo
MacOS 12.6.2 Python 3.11.1 pip 22.3.1 Homebrew 3.6.16 cairo 1.16.0 Apple clang version 11.0.3 (Xcode tools installed, Xcode not installed)
Based on this Stackoverflow answer, it seems the issue is compiler installed on the Mac is older than the MacOS version. https://stackoverflow.com/a/72118836/8524178
The MacOS version is 12.6.2, but if I run clang --version
it returns 11.0.3
Trying to install normally fails with the error (abridged):
creating build/temp.macosx-12-x86_64-cpython-311
creating build/temp.macosx-12-x86_64-cpython-311/cairo
clang ... -O3 -Wall -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=23 -DPYCAIRO_VERSION_MICRO=0 -I/usr/local/Cellar/cairo/1.16.0_5/include/cairo ...
clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=12'
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
Trying to install again with an intentionally invalid MACOSX_DEPLOYMENT_TARGET=0
gives the helpful error message:
MACOSX_DEPLOYMENT_TARGET=0 pip3 install pycairo
creating build/temp.macosx-12-x86_64-cpython-311
creating build/temp.macosx-12-x86_64-cpython-311/cairo
clang ... -O3 -Wall -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=23 -DPYCAIRO_VERSION_MICRO=0 -I/usr/local/Cellar/cairo/1.16.0_5/include/cairo ...
error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "0" but "12" during configure; must use 10.3 or later
[end of output]
Trying the install again with the specified "10.3" version number succeeds!
MACOSX_DEPLOYMENT_TARGET=10.3 pip3 install pycairo
hi! When I try to
pip install pycairo
on OS X 10.15 I get the error:an older version (1.19.1) installs fine. Seems that 1.20.0 depends on the unreleased OSX beta?
more logs: