-
Notifications
You must be signed in to change notification settings - Fork 51
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
Install fails on non-macOS platforms #291
Comments
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren). I won’t change pyobjc to install on other platforms because that will result in support calls by folks that have installed the package but cannot use it. The solution is as you say: adjust your requirements file. I’m keeping this issue open because I want to check if I can tweak the package metadata to tell pip that this package won’t install on platforms other than macOS. |
Original comment by Flynn (Bitbucket: zo7, GitHub: zo7). Yeah if there’s a way to tell pip to gracefully not install pyobjc that would be preferred. I don’t know a way off the top of my head. Manually adjusting the requirements file is not a great solution because it can surprise users who install a package that installs pyobjc downstream. This seems to be happening to a few users over at watchdog. (thanks for maintaining this library and the quick reply!!) |
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren). I’ve checked what pywin32 does, which is a Windows only library, and that fails to install on anything but Windows. They avoid any problems with trying to compile the extension from source by not providing sdists on PyPI. I could do that, but prefer to ship the sources corresponding to releases next to Python wheels. |
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren). Closing this issue as "wont fix" because there's no good solution and I prefer the status quo over the proposed change. |
Original report by Flynn (Bitbucket: zo7, GitHub: zo7).
Summary
Installing pyobjc-core on a non-macOS platform fails with:
While this if of course reasonable because pyobjc is only meant for macOS, it can cause problems for projects when trying to pin dependencies (e.g. using pip freeze, pip-tools, or pipenv)
For example, consider a library
foolib
that is multi-platform, but requirespyobjc-core
as a dependency (and even restricts pyobjc’s installation to only macOS with; sys_platform == "darwin"
) If one was on macOS and wanted to pin dependencies withfoolib
, they may use:However, if a Linux user (or CI system) takes their requirements.txt file and tries to install it with
pip install -r requirements.txt
, it would fail because pyobjc raises an error.(in our case, someone on macOS added a requirement that uses pyobjc as a downstream dependency and broke CI)
Solution
On the user’s end, a quick fix is to manually edit the requirements.txt (or requirements.in, Pipfile, etc.) to explicitly add
pyobjc-core ; sys_platform == "darwin"
as a requirement and ensure it doesn’t get installed on non-macOS platforms.For pyobjc, a more robust solution would be to allow installation on non-macOS platforms (and not compile anything) but raise an error at runtime when trying to use the library on non-macOS platforms.
The text was updated successfully, but these errors were encountered: