-
Notifications
You must be signed in to change notification settings - Fork 658
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
Cannot import on python3: missing c_distances_openmp #1157
Comments
As a fix to the fix, there's a try/except block before this that tries to import the openmp module. The USED_OPENMP import should be moved into this block and set in the except block to False |
This is still weird. This shouldn't require a try/except block @jbarnoud can you import the c_distances_openmp module under python 3 if it's build? |
@kain88-de No I can't. But if I rename c_distances.cpython-34m.so to c_distances_openmp.so then it works. I do not know why the cython files are named this way in python 3 now. I have the issue with cython 0.23.4, I'll try to upgrade cython and see if it changes anything. |
Does this so file name mangling also happen when you create a small test cython project? |
After some more fiddling, it appears that the name mangling comes from PEP3149 and has no impact on whether or not you can import the module. What was causing the problem was that the import was implicitly relative: from c_distances_openmp import OPENMP_ENABLED as USED_OPENMP instead of from .c_distances_openmp import OPENMP_ENABLED as USED_OPENMP I'll push the fix latter today or tomorrow with other python 3 fixes. |
ah yeah that looks like a proper fix. Thanks for looking into it. |
@jbarnoud good spot! Make sure you push onto the right branch, we seem to have 2 currently (#929 and #1155), I think the latter is just improvements on the first, so maybe we could close #929 and work from #1155 instead? ( @tylerjereddy @kain88-de ?) |
This issue got mentioned first in #929.
Expected behaviour
MDAnalysis get imported on python 3.
Actual behaviour
This seems to come from the name given to the so files:
Deleting the
from c_distances_openmp import OPENMP_ENABLED as USED_OPENMP
seems to fix the error (at least at import time). Yet, I expect theUSED_OPENMP
variable to be used somewhere.Code to reproduce the behaviour
On python 3:
Currently version of MDAnalysis:
dev
The text was updated successfully, but these errors were encountered: