Python's wheel package with native libraries fails to load
Created by: marekcirkos
I am having problems loading Python's whl
package that contains native library with prebuilt_python_library
.
Eg. BUCK file:
python_binary(
name = 'app',
main_module = 'app',
deps = [':app_lib'],
platform = 'py3',
)
python_library(
name = 'app_lib',
deps = ['//third-party:pyobjc_core'],
srcs = ['app.py'],
)
prebuilt_python_library(
name = 'pyobjc_core',
binary_src = 'pyobjc_core-4.2.1-cp36-cp36m-macosx_10_6_intel.whl',
)
app.py
is simple
import objc
Fails to load, when calling buck run //:app
with message
Building: finished in 0.7 sec (100%) 3/3 jobs, 2 updated, 33.3% cache miss
Total time: 0.9 sec
Traceback (most recent call last):
File ".bootstrap/_pex/pex.py", line 328, in execute
File ".bootstrap/_pex/pex.py", line 261, in _wrap_coverage
File ".bootstrap/_pex/pex.py", line 293, in _wrap_profiling
File ".bootstrap/_pex/pex.py", line 371, in _execute
File ".bootstrap/_pex/pex.py", line 429, in execute_entry
File ".bootstrap/_pex/pex.py", line 434, in execute_module
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 208, in run_module
return _run_code(code, {}, init_globals, run_name, mod_spec)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "app.py", line 4, in <module>
import objc
File "objc/__init__.py", line 18, in <module>
File "objc/__init__.py", line 15, in _update
ModuleNotFoundError: No module named 'objc._objc'
I suspect this is because objc
module in pyobjc_core
contains file _objc.cpython-36m-darwin.so
that should be loaded as _objc
but it doesn't.
Installing same package with pip3
and running python3 app.py
works like a charm.
Links:
pyobjc_core-4.2.1-cp36-cp36m-macosx_10_6_intel.whl
can be found here https://pypi.org/project/pyobjc-core/#files