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

Install fails on non-macOS platforms #291

Closed
ronaldoussoren opened this issue Feb 1, 2020 · 4 comments
Closed

Install fails on non-macOS platforms #291

ronaldoussoren opened this issue Feb 1, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@ronaldoussoren
Copy link
Owner

Original report by Flynn (Bitbucket: zo7, GitHub: zo7).


Summary

Installing pyobjc-core on a non-macOS platform fails with:

Collecting pyobjc-core==6.1
  Downloading pyobjc-core-6.1.tar.gz (791 kB)
  ...
  ERROR: Command errored out with exit status 1:
  command: ...
  Complete output (2 lines):
  running egg_info
  error: PyObjC requires macOS to build

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 requires pyobjc-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 with foolib, they may use:

$ pip install foolib
$ pip freeze > requirements.txt
$ cat requirements.txt
foolib==1.0
pyobjc-core==6.1

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.

@ronaldoussoren
Copy link
Owner Author

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.

@ronaldoussoren
Copy link
Owner Author

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!!)

@ronaldoussoren
Copy link
Owner Author

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.

@ronaldoussoren
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant