Skip to content

Conversation

@Qubitium
Copy link
Collaborator

@Qubitium Qubitium commented Aug 24, 2025

Try to fix #1729

Signed-off-by: Qubitium <[email protected]>
Signed-off-by: Qubitium <[email protected]>
@jiqing-feng
Copy link
Collaborator

Got this error when pip install -e . on XPU

Obtaining file:///home/sdp/jiqing/GPTQModel
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 35, in <module>
        File "/home/sdp/jiqing/GPTQModel/setup.py", line 356, in <module>
          cpp_ext.CUDAExtension(
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1337, in CUDAExtension
          library_dirs += library_paths(device_type="cuda")
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1548, in library_paths
          if (not os.path.exists(_join_cuda_home(lib_dir)) and
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 2982, in _join_cuda_home
          raise OSError('CUDA_HOME environment variable is not set. '
      OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@Qubitium
Copy link
Collaborator Author

Still buggy. We need to disable all nvcc/rocm kernel cpp_extension compliation when cuda is not found (xpu/cpu env).

@Qubitium Qubitium marked this pull request as draft September 13, 2025 12:02
@Qubitium Qubitium marked this pull request as ready for review September 13, 2025 23:44
Signed-off-by: Qubitium <[email protected]>
@Qubitium
Copy link
Collaborator Author

Qubitium commented Sep 14, 2025

@jiqing-feng Please check again when you have a chance. I have tested in below env:

  1. cuda (nvidia-smi + nvcc exists)
  2. no cuda (simulate xpu)

Still needs testing/validation on rocm

@CSY-ModelCloud We need to check this code for wheel generation since we no longer import torch for cuda tag name generation for wheel dist files.

@Qubitium Qubitium changed the title make torch import in setup optional Remove torch import in setup.py Sep 14, 2025
Signed-off-by: Qubitium <[email protected]>
Signed-off-by: Qubitium <[email protected]>

# Conflicts:
#	setup.py
Signed-off-by: Qubitium <[email protected]>
Signed-off-by: Qubitium <[email protected]>
Signed-off-by: Qubitium <[email protected]>
Signed-off-by: Qubitium <[email protected]>
@Qubitium Qubitium merged commit fa37fb7 into main Sep 14, 2025
5 checks passed
@Qubitium Qubitium deleted the new-setup branch September 14, 2025 13:13
@jiqing-feng
Copy link
Collaborator

I've verified on XPU env, it works. Thanks!

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