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

pyobjc-framework-ScreenCaptureKit version 8.4 fails to install #455

Closed
MagerValp opened this issue Mar 8, 2022 · 6 comments
Closed

pyobjc-framework-ScreenCaptureKit version 8.4 fails to install #455

MagerValp opened this issue Mar 8, 2022 · 6 comments

Comments

@MagerValp
Copy link

MagerValp commented Mar 8, 2022

I'm trying to install pyobjc==8.4 and the pyobjc-framework-ScreenCaptureKit module fails to build with with error: option --single-version-externally-managed not recognized. I'm testing here with python 3.8.9 from Xcode 13.2.1 since that's what happens to be installed, but I'm getting the same error with 3.9.10 and 3.10.2 from python.org.

% sw_vers
ProductName:  macOS
ProductVersion: 12.2.1
BuildVersion: 21D62
% python3 --version
Python 3.8.9
% which python3
/usr/bin/python3
% xcode-select -p
/Applications/Xcode.app/Contents/Developer
% /usr/libexec/PlistBuddy -c 'print :CFBundleShortVersionString' /Applications/Xcode.app/Contents/Info.plist 
13.2.1
% cd Downloads     
Downloads% python3 -m venv test_env
Downloads% source test_env/bin/activate
(test_env) Downloads% pip install pyobjc-framework-ScreenCaptureKit
Collecting pyobjc-framework-ScreenCaptureKit
  Using cached pyobjc-framework-ScreenCaptureKit-8.4.tar.gz (20 kB)
Collecting pyobjc-core>=8.4
  Using cached pyobjc-core-8.4.tar.gz (771 kB)
Collecting pyobjc-framework-CoreMedia>=8.4
  Using cached pyobjc-framework-CoreMedia-8.4.tar.gz (139 kB)
Collecting pyobjc-framework-Cocoa>=8.4
  Using cached pyobjc-framework-Cocoa-8.4.tar.gz (4.6 MB)
Using legacy 'setup.py install' for pyobjc-framework-ScreenCaptureKit, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyobjc-core, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyobjc-framework-CoreMedia, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyobjc-framework-Cocoa, since package 'wheel' is not installed.
Installing collected packages: pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-CoreMedia, pyobjc-framework-ScreenCaptureKit
    Running setup.py install for pyobjc-core ... done
    Running setup.py install for pyobjc-framework-Cocoa ... done
    Running setup.py install for pyobjc-framework-CoreMedia ... done
    Running setup.py install for pyobjc-framework-ScreenCaptureKit ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/pelle/Downloads/test_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-install-2r63a0lt/pyobjc-framework-screencapturekit/setup.py'"'"'; __file__='"'"'/private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-install-2r63a0lt/pyobjc-framework-screencapturekit/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-record-svgtsv4y/install-record.txt --single-version-externally-managed --compile --install-headers /Users/pelle/Downloads/test_env/include/site/python3.8/pyobjc-framework-ScreenCaptureKit
         cwd: /private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-install-2r63a0lt/pyobjc-framework-screencapturekit/
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help
    
    error: option --single-version-externally-managed not recognized
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/pelle/Downloads/test_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-install-2r63a0lt/pyobjc-framework-screencapturekit/setup.py'"'"'; __file__='"'"'/private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-install-2r63a0lt/pyobjc-framework-screencapturekit/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/h1/9qn2f7f14xb4s4slj4lw3h2c0000gp/T/pip-record-svgtsv4y/install-record.txt --single-version-externally-managed --compile --install-headers /Users/pelle/Downloads/test_env/include/site/python3.8/pyobjc-framework-ScreenCaptureKit Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 22.0.4 is available.
You should consider upgrading via the '/Users/pelle/Downloads/test_env/bin/python3 -m pip install --upgrade pip' command.
(test_env) Downloads% 

7.3, 8.0 and 8.2 install just fine. 8.3 fails on Modules/objc/test/objectint.m, but that seems to be fixed in 8.4.

@ronaldoussoren
Copy link
Owner

pyobjc-framework-ScreenCaptureKit won't install on macOS 12.2, it is a binding to a framework that will be introduced in macOS 12.3.

Sadly the error message is less than useful. I get the same error as you when I uninstall the wheel package and the error goes away after installing that package ("pip3 install wheel"), but as mentioned the installation will stil fail: error: This distribution is only supported on MacOSX >= 12.3.

Note that "pip3 install pyobjc" will install all framework bindings that are relevant for your machine, that should also work with the copy of python bundled with Xcode (although I haven't tested this explicitly, I might do so later this week).

ronaldoussoren added a commit that referenced this issue Mar 8, 2022
Trying to install pyobjc-framework-ScrenCaptureKit on a 12.2 system
should give an error message that explains that this package requires
12.3:

   error: This distribution is only supported on MacOSX >= 12.3

This didn't work when the "wheel" package was not installed. Pip
than uses a different code path using
``--single-version-externally-managed`` and that didn't work due
to pyobjc_setup.py using distutils.command.install instead of
setuptools.command.install.

Issue #455
@ronaldoussoren
Copy link
Owner

The next release of PyObjC will give a nicer error message when the wheel package is not installed.

@MagerValp
Copy link
Author

Note that "pip3 install pyobjc" will install all framework bindings that are relevant for your machine, that should also work with the copy of python bundled with Xcode (although I haven't tested this explicitly, I might do so later this week).

I suspect this isn't working as intended. On a Mac with macOS 12.2.1 and Xcode 13.2.1 pip3 install pyobjc==8.4 fails when it comes to the ScreenCaptureKit module. I get the same error if I try to build a relocatable python framework based on python.org's 3.9.10 and 3.10.2 with pyobjc==8.4 in the requirements.

@ronaldoussoren
Copy link
Owner

That's annoying. The code in pyobjc that calculates the framework dependencies basically uses uname -r[1] to check the system version and the table mapping macOS versions to kernel releases had an off by one error for 12.3 :-(.

That code uses uname -r and not sw_vers -productVersion because the latter is not supported in the python wheel specification.

I might push out 8.4.1 tonight or tomorrow to fix this, but need to test that my fix actually works before I do so.

[1]: Although using the Python API, not the command-line tool.

@MagerValp
Copy link
Author

Ah! We finally got decent version numbers for macOS in 11.x, but then they went and messed up the darwin version in 12.0.1. Can't win 😞

Thank you!

@ronaldoussoren
Copy link
Owner

This was fixed in 8.4.1.

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