title: OSError: dlopen(libiodbc.dylib, 6): image not found (Mac Big Sur, Python3.8)
body: <p>I just upgraded my Mac from Mojave to Big Sur, and reinstalled Anaconda and teradata ODBC.  In my Python(3.8) code, I use sqlalchemy-teradata to connect to teradata.  This used to work, but after all the upgrading, my code throws the following error when pulling data from teradata:</p>
  <pre><code>--&gt; 166         demand=pd.read_sql(sql, con=cnxn)
      167     except:
      168         print(&quot;sql string: &quot;+sql)
  
  ~/opt/anaconda3/lib/python3.8/site-packages/pandas/io/sql.py in read_sql(sql, con, index_col, coerce_float, params, parse_dates, columns, chunksize)
      507         )
      508     else:
  --&gt; 509         return pandas_sql.read_query(
      510             sql,
      511             index_col=index_col,
  
  ~/opt/anaconda3/lib/python3.8/site-packages/pandas/io/sql.py in read_query(self, sql, index_col, coerce_float, parse_dates, params, chunksize)
     1293         args = _convert_params(sql, params)
     1294 
  -&gt; 1295         result = self.execute(*args)
     1296         columns = result.keys()
     1297 
  
  ~/opt/anaconda3/lib/python3.8/site-packages/pandas/io/sql.py in execute(self, *args, **kwargs)
     1159     def execute(self, *args, **kwargs):
     1160         &quot;&quot;&quot;Simple passthrough to SQLAlchemy connectable&quot;&quot;&quot;
  -&gt; 1161         return self.connectable.execution_options(no_parameters=True).execute(
     1162             *args, **kwargs
     1163         )
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/base.py in execute(self, statement, *multiparams, **params)
     2232         &quot;&quot;&quot;
     2233 
  -&gt; 2234         connection = self._contextual_connect(close_with_result=True)
     2235         return connection.execute(statement, *multiparams, **params)
     2236 
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _contextual_connect(self, close_with_result, **kwargs)
     2300         return self._connection_cls(
     2301             self,
  -&gt; 2302             self._wrap_pool_connect(self.pool.connect, None),
     2303             close_with_result=close_with_result,
     2304             **kwargs
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
     2334         dialect = self.dialect
     2335         try:
  -&gt; 2336             return fn()
     2337         except dialect.dbapi.Error as e:
     2338             if connection is None:
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/impl.py in connect(self)
      364                 return rec._checkout_existing()
      365 
  --&gt; 366         return _ConnectionFairy._checkout(self, self._fairy)
      367 
      368     def _return_conn(self, record):
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/base.py in _checkout(cls, pool, threadconns, fairy)
      776     def _checkout(cls, pool, threadconns=None, fairy=None):
      777         if not fairy:
  --&gt; 778             fairy = _ConnectionRecord.checkout(pool)
      779 
      780             fairy._pool = pool
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/base.py in checkout(cls, pool)
      493     @classmethod
      494     def checkout(cls, pool):
  --&gt; 495         rec = pool._do_get()
      496         try:
      497             dbapi_connection = rec.get_connection()
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/impl.py in _do_get(self)
      347         except AttributeError:
      348             pass
  --&gt; 349         c = self._create_connection()
      350         self._conn.current = weakref.ref(c)
      351         if len(self._all_conns) &gt;= self.size:
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/base.py in _create_connection(self)
      307         &quot;&quot;&quot;Called by subclasses to create a new ConnectionRecord.&quot;&quot;&quot;
      308 
  --&gt; 309         return _ConnectionRecord(self)
      310 
      311     def _invalidate(self, connection, exception=None, _checkin=True):
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __init__(self, pool, connect)
      438         self.__pool = pool
      439         if connect:
  --&gt; 440             self.__connect(first_connect_check=True)
      441         self.finalize_callback = deque()
      442 
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __connect(self, first_connect_check)
      659         except Exception as e:
      660             with util.safe_reraise():
  --&gt; 661                 pool.logger.debug(&quot;Error on connect(): %s&quot;, e)
      662         else:
      663             if first_connect_check:
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
       66             self._exc_info = None  # remove potential circular references
       67             if not self.warn_only:
  ---&gt; 68                 compat.raise_(
       69                     exc_value,
       70                     with_traceback=exc_tb,
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/util/compat.py in raise_(***failed resolving arguments***)
      180 
      181         try:
  --&gt; 182             raise exception
      183         finally:
      184             # credit to
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __connect(self, first_connect_check)
      654         try:
      655             self.starttime = time.time()
  --&gt; 656             connection = pool._invoke_creator(self)
      657             pool.logger.debug(&quot;Created new connection %r&quot;, connection)
      658             self.connection = connection
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/strategies.py in connect(connection_record)
      112                         if connection is not None:
      113                             return connection
  --&gt; 114                 return dialect.connect(*cargs, **cparams)
      115 
      116             creator = pop_kwarg(&quot;creator&quot;, connect)
  
  ~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/default.py in connect(self, *cargs, **cparams)
      491     def connect(self, *cargs, **cparams):
      492         # inherits the docstring from interfaces.Dialect.connect
  --&gt; 493         return self.dbapi.connect(*cargs, **cparams)
      494 
      495     def create_connect_args(self, url):
  
  ~/opt/anaconda3/lib/python3.8/site-packages/teradata/tdodbc.py in __init__(self, dbType, system, username, password, autoCommit, transactionMode, queryBands, odbcLibPath, dataTypeConverter, driver, **kwargs)
      419 
      420         # Initialize connection handle
  --&gt; 421         init(odbcLibPath)
      422 
      423         # Build connect string
  
  ~/opt/anaconda3/lib/python3.8/site-packages/teradata/tdodbc.py in init(odbcLibPath)
      364     try:
      365         lock.acquire()
  --&gt; 366         initOdbcLibrary(odbcLibPath)
      367         initFunctionPrototypes()
      368         initOdbcEnv()
  
  ~/opt/anaconda3/lib/python3.8/site-packages/teradata/tdodbc.py in initOdbcLibrary(odbcLibPath)
      317                     odbcLibPath = 'libodbc.so'
      318             logger.info(&quot;Loading ODBC Library: %s&quot;, odbcLibPath)
  --&gt; 319             odbc = ctypes.cdll.LoadLibrary(odbcLibPath)
      320 
      321 
  
  ~/opt/anaconda3/lib/python3.8/ctypes/__init__.py in LoadLibrary(self, name)
      457 
      458     def LoadLibrary(self, name):
  --&gt; 459         return self._dlltype(name)
      460 
      461 cdll = LibraryLoader(CDLL)
  
  ~/opt/anaconda3/lib/python3.8/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
      379 
      380         if handle is None:
  --&gt; 381             self._handle = _dlopen(self._name, mode)
      382         else:
      383             self._handle = handle
  
  OSError: dlopen(libiodbc.dylib, 6): image not found
  </code></pre>
  <p>I can see this libiodbc.dylib right under /usr/lib.  Similarly, my ODBC Manager cannot find libiodbcinst.dylib.  Seems to be the same problem.  I've spent 2 days searching for solutions.  I tried disabling SIP, updating brew, adding /usr/lib to DYLD_LIBRARY_PATH, but none of them worked.</p>
  <p>Does anyone have a solution for this?</p>