Skip to content

Unable to import on macOS Big Sur #1885

@sumanthratna

Description

@sumanthratna

From #1484 (comment):

vispy/ext/cocoapy.py calls cdll.LoadLibrary(util.find_library('...')) a bunch of times, but ctypes can't find these libraries on Big Sur. On Catalina, util.find_library('objc') returns /usr/lib/libobjc.dylib and on Big Sur, util.find_library('objc') returns None. These are all the libraries loaded in cocoapy.py:

  • objc
  • CoreFoundation
  • AppKit
  • quartz
  • CoreText
  • Foundation

https://docs.python.org/3/library/ctypes.html#finding-shared-libraries
https://docs.python.org/3/library/ctypes.html#ctypes.LibraryLoader.LoadLibrary

Reproduction

  1. python3 -m pip install vispy
  2. python3 -c "import vispy"; the output is:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/tmp/venv/lib/python3.8/site-packages/vispy/__init__.py", line 30, in <module>
    from .util import config, set_log_level, keys, sys_info  # noqa
  File "/private/tmp/venv/lib/python3.8/site-packages/vispy/util/__init__.py", line 14, in <module>
    from . import fonts       # noqa
  File "/private/tmp/venv/lib/python3.8/site-packages/vispy/util/fonts/__init__.py", line 13, in <module>
    from ._triage import _load_glyph, list_fonts  # noqa, analysis:ignore
  File "/private/tmp/venv/lib/python3.8/site-packages/vispy/util/fonts/_triage.py", line 14, in <module>
    from ._quartz import _load_glyph, _list_fonts
  File "/private/tmp/venv/lib/python3.8/site-packages/vispy/util/fonts/_quartz.py", line 12, in <module>
    from ...ext.cocoapy import cf, ct, quartz, CFRange, CFSTR, CGGlyph, UniChar, \
  File "/private/tmp/venv/lib/python3.8/site-packages/vispy/ext/cocoapy.py", line 1126, in <module>
    NSEventTrackingRunLoopMode = c_void_p.in_dll(
ValueError: dlsym(RTLD_DEFAULT, NSEventTrackingRunLoopMode): symbol not found

See napari/napari#1393 and #1484.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions