Replies: 2 comments 1 reply
-
|
Thanks for the post! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks for the pointer! I want to add that not just mac, but even ubuntu had their own vendor $ cat /usr/lib/python3.12/sitecustomize.py
# install the apport exception handler if available
try:
import apport_python_hook
except ImportError:
pass
else:
apport_python_hook.install() |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you are on macOS and you use a Python installed with Mac Homebrew -
brew install python- and you try to install maturin-import-hook into a virtualenv, it won't work. This is because Homebrew installs a sitecustomize.py into the Python standard library directory (/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/sitecustomize.pyon my computer right now). When Python tries to importsitecustomize, it ends up importing this file and not the one installed/edited by maturin-import-hook.A workaround is to install Python in some other way. I'm using
uvto manage the virtualenvs, so I useduv venv --managed-pythonwhich creates the virtualenv with uv-installed Python.I wanted to share this information as I was confused about why I couldn't get the import hook to work. I'm not sure if this should be considered a bug in the import hook, but maybe using a
.pthfile instead ofsitecustomize.pycould make it work even in this case.Beta Was this translation helpful? Give feedback.
All reactions