-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: PyO3 modules may only be initialized once per interpreter process #481
Comments
It looks like PyO3 does not support sub-interpreters. The recommended way to ensure compatibility with modules that do not support sub interpreters is to use SharedInterpreter instead of SubInterpreters. Another workaround is to add any modules that are not compatible with sub-interpreters to the shared modules for every jep interpreter. When this is done the module is imported once, on the MainInterpreter and not imported in any other interpreter. It looks like you have already tried that, however I suspect your module may have components or dependencies that are incompatible with sub-interpreters and those may also need to be added to the list of shared modules. I have found it is often a cascading problem and it can require making many modules shared to get things working. Since the MainInterpreter is not importing any modules other than the shared modules you specify, I do not think it is directly the source of the problem, it is more of a general problem with sub-interpreters and SharedInterpreter is the simplest solution. |
@bsteffensmeier thank you for your prompt response! Based on your feedback we have switched our tool to use |
Switching to |
The following error occurs when attempting to use PyO3 modules with Jep:
See original issue here.
I am wondering if this is an incompatibility with Jep's use of a
MainInterpreter
?The text was updated successfully, but these errors were encountered: