Okay, this is not strictly a "Linux" question, but it's close.
(MacOS is Unix® ...)
All of the sudden, Python can no longer locate the MySQL interface libraries: it now thinks that they are in
/usr/bin.
I can see from the traceback that it is using
@rpath to find the location, and that it knows the name of the library that it should be looking for. But it's not looking in the right place anymore.
(As I've said, "this used to work ...")
All of the web postings that I've so far found about "rpath" imply that in order to change it you must patch the binary. But that makes no sense to me. Obviously there should be
something, somewhere, that informs Python where to look. But now it's broken – actually, "it
broke" – and I really not enough of a Python God to understand why.
Relevant traceback:
Code:
File "/Users/mike/.virtualenvs/djangoprod/lib/python3.11/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/mike/.virtualenvs/djangoprod/lib/python3.11/site-packages/MySQLdb/_mysql.cpython-311-darwin.so, 0x0002): Library not loaded: '@rpath/libmysqlclient.21.dylib'
Referenced from: '/Users/mike/.virtualenvs/djangoprod/lib/python3.11/site-packages/MySQLdb/_mysql.cpython-311-darwin.so'
Reason: tried: '/usr/lib/libmysqlclient.21.dylib' (no such file)
Right now I am considering
nuking the present "virtual environment" and re-creating it from scratch ... because it sure looks like "everything that's now going very wrong" is inside it. But I'd right now really like to hear from anyone who is more familiar with this "magick" than I am.