Both the 2020.1 and 2020.2 release give me an error when I use SO_REUSEPORT:
$ python3 --version Python 3.7.7 :: Intel(R) Corporation $ ipython3 Python 3.7.7 (default, Jun 26 2020, 05:10:03) Type 'copyright', 'credits' or 'license' for more information IPython 7.17.0 -- An enhanced Interactive Python. Type '?' for help. In : import socket In : s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) In : s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, True) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-abe33f584d23> in <module> ----> 1 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, True) AttributeError: module 'socket' has no attribute 'SO_REUSEPORT'
I am installing through Anaconda on Ubuntu 20.04.
If I create a conda virtual environment without INTEL using the same python version 3.7.7, I have the same issue so perhaps it's a problem with the base Anaconda Python version?
I do not have this issue with the current Anaconda Python 3.8.5 (non-Intel obviously).
Also, if I pull a docker image for Python 3.7.8 (non-Intel) I don't have this problem.
(I can't find an Anaconda Python 3.7.8, nor a docker Python 3.7.7, so I can't isolate the problem to Anaconda or the 3.7.7.)
Assuming this is not fixable in the current Intel Python release, is Intel planning to switch to Python 3.8 for the next release?
Thank you for posting in Intel Forum.
We could reproduce your issue in python 3.7.7.We will inform this to the concerned team. However we observed that the issue is not present in the older version python 3.6.3. As a workaround, you can use the older version. We are forwarding this query to the concerned team so that they will help you with the future release plan.
The issue is still there on 3.7.9 release, and we feedbacked the issue back to engineer team.
In the meantime, Does SO_REUSEADDR work for you?
SO_REUSEADDR is functional on current 3.7.9 release.
Thanks for continuing to track this issue.
SO_REUSEADDR does work for me in some scenarios, but the as a solution it isn't great and isn't quite the same. Although my example was a simple socket.socket() example, I'm mostly losing asyncio, and if you look at:
you'll see that SO_REUSEADDR is recommended against due to security concerns and is explicitly blocked in 3.8.1 for that reason. They say you should only use SO_REUSEPORT.
I did find a hack workaround:
import socket if not hasattr(socket, 'SO_REUSEPORT'): socket.SO_REUSEPORT = 15
In all the systems I use, SO_REUSEPORT is 15, so this works for me, but it's really not good to do something like this so I'm very thankful you are still tracking this issue.
As best I can tell this is compile-time issue for Python where it gets the value from the Linux socket C library, so the Intel Engineering Team must be compiling the Python in some way that doesn't get this from the underlying Linux socket interface.
Please keep me updated as new releases become available.
It indeed a compile time issue, and our engineer team is aware of this problem.
They are looking into supporting this in the future and will announce the fix in our webpage or release notes.