[GH-ISSUE #350] Build Failure: Failed to build DeepEP with Python 3.9 and NVSHMEM wheel package. #243

Closed
opened 2026-10-26 09:57:14 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @windreamer on GitHub (Aug 1, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/350

Summary

Building DeepEP fails when using Python 3.9 and the nvidia-nvshmem-cu12 wheel package.

Bug detail

Reproduction Steps:

  1. Create a virtual environment: uv venv -p python3.9 --seed
  2. Activate the environment: source .venv/bin/activate
  3. Install dependencies: pip install torch nvidia-nvshmem-cu12
  4. Build the wheel: python setup.py bdist_wheel
$ uv venv -p python3.9 --seed
$ source .venv/bin/activate
$ pip install torch nvidia-nvshmem-cu12
$ python setup.py bdist_wheel 

Expected Behavior:

The wheel builds successfully.

Actual Behavior:

The build process fails. The full error output for diagnosis as follows:

/home/windreamer/codebase/DeepEP/.venv/lib/python3.9/site-packages/torch/_subclasses/functional_tensor.py:276: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.)
  cpu = _conversion_method_template(device=torch.device("cpu"))
Traceback (most recent call last):
  File "/home/windreamer/codebase/DeepEP/setup.py", line 24, in <module>
    nvshmem_host_lib = get_nvshmem_host_lib_name()
  File "/home/windreamer/codebase/DeepEP/setup.py", line 11, in get_nvshmem_host_lib_name
    for path in importlib.resources.files('nvidia.nvshmem').iterdir():
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/resources.py", line 147, in files
    return _common.from_package(_get_package(package))
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 14, in from_package
    return fallback_resources(package.__spec__)
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 18, in fallback_resources
    package_directory = pathlib.Path(spec.origin).parent
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 1000, in __new__
    self = cls._from_parts(args, init=False)
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 625, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 609, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Originally created by @windreamer on GitHub (Aug 1, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/350 # Summary Building DeepEP fails when using Python 3.9 and the `nvidia-nvshmem-cu12` wheel package. # Bug detail **Reproduction Steps:** 1. Create a virtual environment: `uv venv -p python3.9 --seed` 2. Activate the environment: `source .venv/bin/activate` 3. Install dependencies: `pip install torch nvidia-nvshmem-cu12` 4. Build the wheel: `python setup.py bdist_wheel` ```shell $ uv venv -p python3.9 --seed $ source .venv/bin/activate $ pip install torch nvidia-nvshmem-cu12 $ python setup.py bdist_wheel ``` **Expected Behavior:** The wheel builds successfully. **Actual Behavior:** The build process fails. The full error output for diagnosis as follows: ``` /home/windreamer/codebase/DeepEP/.venv/lib/python3.9/site-packages/torch/_subclasses/functional_tensor.py:276: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.) cpu = _conversion_method_template(device=torch.device("cpu")) Traceback (most recent call last): File "/home/windreamer/codebase/DeepEP/setup.py", line 24, in <module> nvshmem_host_lib = get_nvshmem_host_lib_name() File "/home/windreamer/codebase/DeepEP/setup.py", line 11, in get_nvshmem_host_lib_name for path in importlib.resources.files('nvidia.nvshmem').iterdir(): File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/resources.py", line 147, in files return _common.from_package(_get_package(package)) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 14, in from_package return fallback_resources(package.__spec__) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 18, in fallback_resources package_directory = pathlib.Path(spec.origin).parent File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 1000, in __new__ self = cls._from_parts(args, init=False) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 625, in _from_parts drv, root, parts = self._parse_args(args) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 609, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType ```
Author
Owner

@alpha-baby commented on GitHub (Aug 4, 2025):

maybe caused by: No module named 'numpy', you need install: pip3 install numpy

<!-- gh-comment-id:3148953268 --> @alpha-baby commented on GitHub (Aug 4, 2025): maybe caused by: No module named 'numpy', you need install: `pip3 install numpy`
Author
Owner

@windreamer commented on GitHub (Aug 4, 2025):

Seems not. Even if I added numpy, the build fails too. The error is the same.

$ uv venv -p python3.9 --seed
$ source .venv/bin/activate
$ pip install torch nvidia-nvshmem-cu12 numpy
$ python setup.py bdist_wheel

Error output:

$ python setup.py bdist_wheel
Traceback (most recent call last):
  File "/home/windreamer/DeepEP/setup.py", line 24, in <module>
    nvshmem_host_lib = get_nvshmem_host_lib_name()
  File "/home/windreamer/DeepEP/setup.py", line 11, in get_nvshmem_host_lib_name
    for path in importlib.resources.files('nvidia.nvshmem').iterdir():
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/resources.py", line 147, in files
    return _common.from_package(_get_package(package))
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 14, in from_package
    return fallback_resources(package.__spec__)
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 18, in fallback_resources
    package_directory = pathlib.Path(spec.origin).parent
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 1000, in __new__
    self = cls._from_parts(args, init=False)
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 625, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 609, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
<!-- gh-comment-id:3150788434 --> @windreamer commented on GitHub (Aug 4, 2025): Seems not. Even if I added `numpy`, the build fails too. The error is the same. ```shell $ uv venv -p python3.9 --seed $ source .venv/bin/activate $ pip install torch nvidia-nvshmem-cu12 numpy $ python setup.py bdist_wheel ``` Error output: ``` $ python setup.py bdist_wheel Traceback (most recent call last): File "/home/windreamer/DeepEP/setup.py", line 24, in <module> nvshmem_host_lib = get_nvshmem_host_lib_name() File "/home/windreamer/DeepEP/setup.py", line 11, in get_nvshmem_host_lib_name for path in importlib.resources.files('nvidia.nvshmem').iterdir(): File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/resources.py", line 147, in files return _common.from_package(_get_package(package)) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 14, in from_package return fallback_resources(package.__spec__) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/_common.py", line 18, in fallback_resources package_directory = pathlib.Path(spec.origin).parent File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 1000, in __new__ self = cls._from_parts(args, init=False) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 625, in _from_parts drv, root, parts = self._parse_args(args) File "/home/windreamer/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/pathlib.py", line 609, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType ```
Author
Owner

@windreamer commented on GitHub (Aug 4, 2025):

I believe this is directly related to this python bug

<!-- gh-comment-id:3150818108 --> @windreamer commented on GitHub (Aug 4, 2025): I believe this is directly related to [this python bug](https://bugs.python.org/issue42531)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#243
No description provided.