Skip to content

Conversation

@Kontinuation
Copy link
Member

@Kontinuation Kontinuation commented Dec 19, 2025

What changes were proposed in this pull request?

This PR fixes an error caused by socketserver.UnixStreamServer not being available on Windows. We define a fallback AccumulatorUnixServer to raise an exception on construction and inform the user to disable spark.python.unix.domain.socket.enabled.

Why are the changes needed?

import pyspark fails with the following message on Windows since PySpark 4.1.0:

sedona\spark\__init__.py:19: in <module>
    import pyspark
.venv\Lib\site-packages\pyspark\__init__.py:71: in <module>
    from pyspark.accumulators import Accumulator, AccumulatorParam
.venv\Lib\site-packages\pyspark\accumulators.py:324: in <module>
    class AccumulatorUnixServer(socketserver.UnixStreamServer):
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'socketserver' has no attribute 'UnixStreamServer'

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Manually test this on Windows 11

Was this patch authored or co-authored using generative AI tooling?

No.

@Kontinuation Kontinuation changed the title [WIP][SPARK-54745][PYTHON] Workaround import pyspark error caused by socketserver.UnixStreamServer not supported on Windows [WIP][SPARK-54745][PYTHON] Fix PySpark import error caused by missing UnixStreamServer on Windows Dec 19, 2025
@Kontinuation Kontinuation force-pushed the fix-uds-windows-compat branch from 80541b9 to bcdb386 Compare December 19, 2025 16:44
@Kontinuation Kontinuation force-pushed the fix-uds-windows-compat branch from bcdb386 to 20f8be0 Compare December 19, 2025 17:22
@HyukjinKwon
Copy link
Member

I think the change is pretty straightforward. Please let me know when it's tested. I can merge

@Kontinuation Kontinuation changed the title [WIP][SPARK-54745][PYTHON] Fix PySpark import error caused by missing UnixStreamServer on Windows [SPARK-54745][PYTHON] Fix PySpark import error caused by missing UnixStreamServer on Windows Dec 21, 2025
@Kontinuation Kontinuation marked this pull request as ready for review December 21, 2025 02:56
@Kontinuation
Copy link
Member Author

I have tested this on Windows 11 and it worked well. I think it is good to merge.

@HyukjinKwon
Copy link
Member

Merged to master and branch-4.1.

HyukjinKwon pushed a commit that referenced this pull request Dec 21, 2025
…StreamServer on Windows

### What changes were proposed in this pull request?

This PR fixes an error caused by `socketserver.UnixStreamServer` not being available on Windows. We define a fallback `AccumulatorUnixServer` to raise an exception on construction and inform the user to disable `spark.python.unix.domain.socket.enabled`.

### Why are the changes needed?

`import pyspark` fails with the following message on Windows since PySpark 4.1.0:

```
sedona\spark\__init__.py:19: in <module>
    import pyspark
.venv\Lib\site-packages\pyspark\__init__.py:71: in <module>
    from pyspark.accumulators import Accumulator, AccumulatorParam
.venv\Lib\site-packages\pyspark\accumulators.py:324: in <module>
    class AccumulatorUnixServer(socketserver.UnixStreamServer):
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'socketserver' has no attribute 'UnixStreamServer'
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manually test this on Windows 11

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #53546 from Kontinuation/fix-uds-windows-compat.

Authored-by: Kristin Cowalcijk <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
(cherry picked from commit a8f817d)
Signed-off-by: Hyukjin Kwon <[email protected]>
@HyukjinKwon
Copy link
Member

Thanks @Kontinuation !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants