I need to use pyobjc on macos. So I create a package with like this:
let
newPython = pkgs.python312.override
{
self = newPython;
packageOverrides = pself: psuper: {
pyobjc-core = pself.buildPythonPackage rec {
pname = "pyobjc-core";
version = "10.3.1";
format = "wheel";
src = fetchurl {
url = "https://files.pythonhosted.org/packages/2e/8b/341571ac5d625968083cbd718e1af7eac54197ed3d404dfff9467c3a8c88/pyobjc_core-10.3.1-cp313-cp313-macosx_10_13_universal2.whl";
hash = "sha256-JYHo5oiFvLDhHsYZ6B7yjgjuP6xN4g2MyDvFr1vPSpA=";
};
};
};
};
in
{
home.packages = with pkgs;
[
(newPython.withPackages
(pypkg: with pypkg; [
pyobjc-core
]))
];
}
I use home-manager switch, the install is correct. But import objc
in python interpreter complains:
Python 3.12.5 (main, Aug 6 2024, 19:08:49) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nix/store/w599jwl16xzzbm8vdrw5mwm2fanb2yvh-python3-3.12.5-env/lib/python3.12/site-packages/objc/__init__.py", line 7, in <module>
from . import _objc
ImportError: cannot import name '_objc' from partially initialized module 'objc' (most likely due to a circular import) (/nix/store/w599jwl16xzzbm8vdrw5mwm2fanb2yvh-python3-3.12.5-env/lib/python3.12/site-packages/objc/__init__.py)
This is the pyobjc-core packge content. It seems that _objc
is a shared library.
__init__.py _compat.py _convenience_nsdecimal.py _descriptors.py _machsignals.cpython-313-darwin.so _pythonify.py
__pycache__ _context.py _convenience_nsdictionary.py _dyld.py _new.py _structtype.py
_bridges.py _convenience.py _convenience_nsobject.py _framework.py _objc.cpython-313-darwin.so _transform.py
_bridgesupport.py _convenience_mapping.py _convenience_nsset.py _informal_protocol.py _properties.py simd.py
_callable_docstr.py _convenience_nsarray.py _convenience_nsstring.py _lazyimport.py _protocols.py
_category.py _convenience_nsdata.py _convenience_sequence.py _locking.py _pycoder.py
Install the pyobjc-core without nix just works fine. (On macos, system python)
Any help? THX