Skip to content
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

rename example.cpython-311-x86_64-linux-gnu.so to example.so #4738

Closed
wants to merge 2 commits into from

Conversation

swuecho
Copy link

@swuecho swuecho commented Jul 12, 2023

No description provided.

@@ -159,7 +159,7 @@ Python's ``setuptools`` to build the module, while `cmake_example`_ uses CMake

Building the above C++ code will produce a binary module file that can be
imported to Python. Assuming that the compiled module is located in the
current directory (in newer version of python, rename the `example.cpython-xxx-linux-gun.so` to `example.so`) , the following interactive Python session shows how to
current directory (in newer version of python, rename the ``example.cpython-xxx-linux-gun.so`` to ``example.so``) , the following interactive Python session shows how to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see example.cpython-*.so with python_example, or cmake_example, or both?

@henryiii could this be fixed in the setuptools and/or cmake config?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not want to do this. This is not Python version specific - it's always worked and always been a bad idea. The SOABI that you are removing is how it avoids loading on a version of Python it wasn't compiled for. PyPy won't even load an extension without the SOABI.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

("this" meaning this PR, not this comment)

Is there some problem you are trying to solve? It would help to know what the issue is. Is some setup accedently producing example.so instead of a properly named extension? The pybind11 tools should do this correctly; if you use FindPython directly, you need to pass the SOABI flag (sadly not the default).

Copy link
Member

@jagerman jagerman Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally aside: there is a typo (not fixed here, but in the changed line) of linux-gun -> linux-gnu

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, didn't see that. Pretty sure we aren't accepting this unless more info into why it's needed is given. Nothing should be producing binaries without SOABI, so maybe it's a fix somewhere else that's needed.

@swuecho
Copy link
Author

swuecho commented Jul 13, 2023

image

@swuecho
Copy link
Author

swuecho commented Jul 13, 2023

image

@swuecho
Copy link
Author

swuecho commented Jul 13, 2023

It take me a while to figure out I need example.so instead of the example.cpython-311-x86_64-linux-gnu.so , hence the pr.

@henryiii
Copy link
Collaborator

henryiii commented Jul 13, 2023

Nope, that's not the correct solution. You are building with Python 3.11, then running with IPython that's been installed with Python 3.10. If you are lucky, it might work, but it will more likely segfault. You can't use a Python 3.x extension with Python 3.y when $x\ne y$.

You need to either build with 3.10 or load it in 3.11. That's one of the reasons for this extension - to protect against that. (Or you can install a kernel for 3.11 and use that with the existing IPython)

@henryiii
Copy link
Collaborator

(PS: thank you for the clear description with example of what was happening!)

@swuecho
Copy link
Author

swuecho commented Jul 13, 2023

image

verified works great with correct python version. my bad! Sorry to bother you.

@swuecho swuecho closed this Jul 13, 2023
@henryiii
Copy link
Collaborator

No problem, glad it works now! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants