btrack: Cannot load dylib on Intel macbooks

From Ania:

1.4 GHz Intel Core i5

File /opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libwrapper.py:84, in load_library(filename)
     83 try:
---> 84     lib = ctypes.cdll.LoadLibrary(full_lib_file)
     85     logger.info(f"Loaded btrack: {full_lib_file}")

File /opt/anaconda3/envs/btrack-env/lib/python3.10/ctypes/__init__.py:452, in LibraryLoader.LoadLibrary(self, name)
    451 def LoadLibrary(self, name):
--> 452     return self._dlltype(name)

File /opt/anaconda3/envs/btrack-env/lib/python3.10/ctypes/__init__.py:374, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    373 if handle is None:
--> 374     self._handle = _dlopen(self._name, mode)
    375 else:

OSError: dlopen(/opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libs/libtracker.dylib, 6): no suitable image found.  Did find:
	/opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libs/libtracker.dylib: cannot load 'libtracker.dylib' (load command 0x80000034 is unknown)
	/opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libs/libtracker.dylib: cannot load 'libtracker.dylib' (load command 0x80000034 is unknown)

The above exception was the direct cause of the following exception:

OSError                                   Traceback (most recent call last)
Cell In[12], line 1
----> 1 with btrack.BayesianTracker() as tracker:
      2 
      3     # configure the tracker using a config file
      4     tracker.configure(cfg)
      5     tracker.max_search_radius = 20

File /opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/core.py:130, in BayesianTracker.__init__(self, verbose)
    128 # load the library, get an instance of the engine
    129 self._initialised = False
--> 130 self._lib = libwrapper.get_library()
    131 self._engine = self._lib.new_interface(verbose)
    133 if not verbose:

File /opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libwrapper.py:94, in get_library()
     92 def get_library():  # noqa: PLR0915
     93     """Loads and returns the btrack shared library."""
---> 94     lib = load_library(os.path.join(BTRACK_PATH, "libs", "libtracker"))
     96     # deal with constructors/destructors
     97     lib.new_interface.restype = ctypes.c_void_p

File /opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libwrapper.py:87, in load_library(filename)
     85     logger.info(f"Loaded btrack: {full_lib_file}")
     86 except OSError as err:
---> 87     raise OSError(f"Cannot load shared library {full_lib_file}") from err
     89 return lib

OSError: Cannot load shared library /opt/anaconda3/envs/btrack-env/lib/python3.10/site-packages/btrack/libs/libtracker.dylib

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

Also @paddyroddy - I just tried a fresh install (btrack 0.5.13 from pypi) on:

  • Intel® Core™ i9-10940X CPU
  • Ubuntu 20.04.5 LTS
  • Python 3.9

…and everything seemed to work ok.

I went down a self inflicted sort-of-related rabbit hole this evening (courtesy of @paddyroddy 😉), and while I was down there at one point I was getting errors like:

[1/2] Compiling C++ object tracker.p/tracker.cc.o
FAILED: tracker.p/tracker.cc.o 
ccache c++ -Itracker.p -I. -I.. -I../../include -I../../../include -I/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3 -fcolor-diagnostics -Wall -Winvalid-pch -O0 -g -std=c++17 '-arch arm64' -MD -MQ tracker.p/tracker.cc.o -MF tracker.p/tracker.cc.o.d -o tracker.p/tracker.cc.o -c ../tracker.cc
clang: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
In file included from ../tracker.cc:17:
../../include/tracker.h:268:20: error: 'path' is unavailable: introduced in macOS 10.15
  std::filesystem::path m_debug_filepath;

I think this means btrack is using c++ calls only available in macOS >= 10.15, so it won’t work with macOS < 10.15.