ronaldoussoren / pyobjc

The Python <-> Objective-C Bridge with bindings for macOS frameworks
https://pyobjc.readthedocs.io
545 stars 46 forks source link

Cannot install with pip3 while using an active venv environment. #422

Open Rcsuax opened 2 years ago

Rcsuax commented 2 years ago
Running setup.py install for pyobjc-framework-IntentsUI ... error
ERROR: Command errored out with exit status 1:
 command: /Users/reuben/Scratch/python/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-install-ipa__891/pyobjc-framework-intentsui/setup.py'"'"'; __file__='"'"'/private/var/folders/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-install-ipa__891/pyobjc-framework-intentsui/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/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-record-iwuo7l5l/install-record.txt --single-version-externally-managed --compile --install-headers /Users/reuben/Scratch/python/venv/include/site/python3.8/pyobjc-framework-IntentsUI
     cwd: /private/var/folders/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-install-ipa__891/pyobjc-framework-intentsui/
Complete output (25 lines):
running install
running build
running build_py
overriding build_packages to copy PyObjCTest
creating build
creating build/lib.macosx-10.14-arm64-3.8
creating build/lib.macosx-10.14-arm64-3.8/IntentsUI
copying Lib/IntentsUI/_metadata.py -> build/lib.macosx-10.14-arm64-3.8/IntentsUI
copying Lib/IntentsUI/__init__.py -> build/lib.macosx-10.14-arm64-3.8/IntentsUI
creating build/lib.macosx-10.14-arm64-3.8/PyObjCTest
copying PyObjCTest/test_inuieditvoiceshortcutviewcontroller.py -> build/lib.macosx-10.14-arm64-3.8/PyObjCTest
copying PyObjCTest/__init__.py -> build/lib.macosx-10.14-arm64-3.8/PyObjCTest
copying PyObjCTest/test_inuiaddvoiceshortcutbutton.py -> build/lib.macosx-10.14-arm64-3.8/PyObjCTest
copying PyObjCTest/test_intentsui.py -> build/lib.macosx-10.14-arm64-3.8/PyObjCTest
copying PyObjCTest/test_inuiaddvoiceshortcutviewcontroller.py -> build/lib.macosx-10.14-arm64-3.8/PyObjCTest
running build_ext
building 'IntentsUI._IntentsUI' extension
creating build/temp.macosx-10.14-arm64-3.8
creating build/temp.macosx-10.14-arm64-3.8/Modules
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/reuben/Scratch/python/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c Modules/_IntentsUI.m -o build/temp.macosx-10.14-arm64-3.8/Modules/_IntentsUI.o -Wno-deprecated-declarations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -DPyObjC_BUILD_RELEASE=1103 -Werror
Modules/_IntentsUI.m:8:9: fatal error: 'IntentsUI/IntentsUI.h' file not found
#import <IntentsUI/IntentsUI.h>
        ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /Users/reuben/Scratch/python/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-install-ipa__891/pyobjc-framework-intentsui/setup.py'"'"'; __file__='"'"'/private/var/folders/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-install-ipa__891/pyobjc-framework-intentsui/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/_m/blsvyfj500d22lr9mcl022l00000gn/T/pip-record-iwuo7l5l/install-record.txt --single-version-externally-managed --compile --install-headers /Users/reuben/Scratch/python/venv/include/site/python3.8/pyobjc-framework-IntentsUI Check the logs for full command output.

If I run the install command outside the virtual environment the installation is completed; but with the caveat that it is polluting my python environment. running pip list shows 10+ packages for pyobjc which I would prefer to be separated from my python packages that I use daily.

ronaldoussoren commented 2 years ago

Weird, especially that the build fails inside a virtualenv and succeeds globally. I haven't seen that before.

I have a number of questions:

I provide binary wheels both to make installing (a lot) faster, and to avoid build problems like this. I fix build errors when I notice them, but somehow I run into issues like this a lot less than users of PyObjC :-(

LittleSmart commented 1 year ago

macOS Montrrey 14.2,Python3.8, 'pip install pyautogui' command have same issue,happens to pyobjc-framework-IntentsUI, pyobjc-framework-ScreenCaptureKit and pyobjc-framework-ShazamKit. following is error while install IntentsUI

Defaulting to user installation because normal site-packages is not writeable Collecting pyobjc-framework-IntentsUI Using cached pyobjc-framework-IntentsUI-9.0.tar.gz (19 kB) Requirement already satisfied: pyobjc-core>=9.0 in ./Library/Python/3.8/lib/python/site-packages (from pyobjc-framework-IntentsUI) (9.0) Requirement already satisfied: pyobjc-framework-Intents>=9.0 in ./Library/Python/3.8/lib/python/site-packages (from pyobjc-framework-IntentsUI) (9.0) Requirement already satisfied: pyobjc-framework-Cocoa>=9.0 in ./Library/Python/3.8/lib/python/site-packages (from pyobjc-framework-Intents>=9.0->pyobjc-framework-IntentsUI) (9.0) Building wheels for collected packages: pyobjc-framework-IntentsUI Building wheel for pyobjc-framework-IntentsUI (setup.py) ... error ERROR: Command errored out with exit status 1: command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/setup.py'"'"'; file='"'"'/private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-wheel-prykyvx5 cwd: /private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/ Complete output (25 lines): running bdist_wheel running build running build_py overriding build_packages to copy PyObjCTest creating build creating build/lib.macosx-10.14-x86_64-3.8 creating build/lib.macosx-10.14-x86_64-3.8/IntentsUI copying Lib/IntentsUI/_metadata.py -> build/lib.macosx-10.14-x86_64-3.8/IntentsUI copying Lib/IntentsUI/init.py -> build/lib.macosx-10.14-x86_64-3.8/IntentsUI creating build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_inuieditvoiceshortcutviewcontroller.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/init.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_inuiaddvoiceshortcutbutton.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_intentsui.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_inuiaddvoiceshortcutviewcontroller.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest running build_ext building 'IntentsUI._IntentsUI' extension creating build/temp.macosx-10.14-x86_64-3.8 creating build/temp.macosx-10.14-x86_64-3.8/Modules clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c Modules/_IntentsUI.m -o build/temp.macosx-10.14-x86_64-3.8/Modules/_IntentsUI.o -Wno-deprecated-declarations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -DPyObjC_BUILD_RELEASE=1103 -Werror Modules/_IntentsUI.m:8:9: fatal error: 'IntentsUI/IntentsUI.h' file not found

import <IntentsUI/IntentsUI.h>

      ^~~~~~~~~~~~~~~~~~~~~~~

1 error generated. error: command 'clang' failed with exit status 1

ERROR: Failed building wheel for pyobjc-framework-IntentsUI Running setup.py clean for pyobjc-framework-IntentsUI Failed to build pyobjc-framework-IntentsUI Installing collected packages: pyobjc-framework-IntentsUI Running setup.py install for pyobjc-framework-IntentsUI ... error ERROR: Command errored out with exit status 1: command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/setup.py'"'"'; file='"'"'/private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/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/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-record-0fx5v_ss/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/mxj/Library/Python/3.8/include/python3.8/pyobjc-framework-IntentsUI cwd: /private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/ Complete output (25 lines): running install running build running build_py overriding build_packages to copy PyObjCTest creating build creating build/lib.macosx-10.14-x86_64-3.8 creating build/lib.macosx-10.14-x86_64-3.8/IntentsUI copying Lib/IntentsUI/_metadata.py -> build/lib.macosx-10.14-x86_64-3.8/IntentsUI copying Lib/IntentsUI/init.py -> build/lib.macosx-10.14-x86_64-3.8/IntentsUI creating build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_inuieditvoiceshortcutviewcontroller.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/init.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_inuiaddvoiceshortcutbutton.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_intentsui.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest copying PyObjCTest/test_inuiaddvoiceshortcutviewcontroller.py -> build/lib.macosx-10.14-x86_64-3.8/PyObjCTest running build_ext building 'IntentsUI._IntentsUI' extension creating build/temp.macosx-10.14-x86_64-3.8 creating build/temp.macosx-10.14-x86_64-3.8/Modules clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c Modules/_IntentsUI.m -o build/temp.macosx-10.14-x86_64-3.8/Modules/_IntentsUI.o -Wno-deprecated-declarations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -DPyObjC_BUILD_RELEASE=1103 -Werror Modules/_IntentsUI.m:8:9: fatal error: 'IntentsUI/IntentsUI.h' file not found

import <IntentsUI/IntentsUI.h>

        ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/setup.py'"'"'; file='"'"'/private/var/folders/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-install-0xc9286a/pyobjc-framework-intentsui/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/d9/2_r0xr9935vfzl9q7nz5m9j80000gn/T/pip-record-0fx5v_ss/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/mxj/Library/Python/3.8/include/python3.8/pyobjc-framework-IntentsUI Check the logs for full command output. WARNING: You are using pip version 20.2.3; however, version 22.3.1 is available. You should consider upgrading via the '/Applications/Xcode.app/Contents/Developer/usr/bin/python3 -m pip install --upgrade pip' command.

ronaldoussoren commented 1 year ago

Hmm, I'll have to spin up a 10.14 VM to check what's going on as the problematic bindings should not be installed on macOS 10.14 in the first place when install the pyobjc package.

ronaldoussoren commented 1 year ago

(deleted previous message because it was factually incorrect).

I cannot reproduce the issue:

The Python included in Xcode resulted in building wheels, but skipped the problematic packages (as it should).

@LittleSmart : Which version of Xcode do you have installed?