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

Build from source fails with older versions of setuptools (<72.2.0) because of PosixPath types returned from .glob #738

Open
fergusfinn opened this issue Jan 16, 2025 · 0 comments

Comments

@fergusfinn
Copy link
Contributor

fergusfinn commented Jan 16, 2025

The following dockerfile should successfully install flashinfer, but the build fails

FROM pytorch/pytorch:2.4.0-cuda12.4-cudnn9-devel

ENV TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0a"
RUN apt update && apt install -y git
RUN pip install setuptools packaging ninja build

RUN git clone https://github.com/flashinfer-ai/flashinfer.git --recursive && \
  cd flashinfer/ && \
  echo "TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST}" && \
  TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}" FLASHINFER_ENABLE_AOT=1 python3 -m pip install --no-build-isolation --verbose --editable .

Error is

    File "/opt/conda/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1142, in CUDAExtension
      return setuptools.Extension(name, sources, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/conda/lib/python3.11/site-packages/setuptools/extension.py", line 134, in __init__
      super().__init__(name, sources, *args, **kw)
    File "/opt/conda/lib/python3.11/site-packages/setuptools/_distutils/extension.py", line 110, in __init__
      raise AssertionError("'sources' must be a list of strings")
  AssertionError: 'sources' must be a list of strings
  error: subprocess-exited-with-error

The problem is that the .glob function in setup.py returns PosixPath objects (on posix systems), which setuptools < 72.2.0 (link) can't handle. The default installed setuptools with this dockerfile is 68.x

Updating the setuptools versions is a workaround

FROM pytorch/pytorch:2.4.0-cuda12.4-cudnn9-devel

ENV TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0a"
RUN apt update && apt install -y git
RUN pip install setuptools==75.6.0 packaging==23.2 ninja==1.11.1.3 build==1.2.2.post1

RUN git clone https://github.com/flashinfer-ai/flashinfer.git --recursive && \
  cd flashinfer/ && \
  TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}" FLASHINFER_ENABLE_AOT=1 python3 -m pip install --no-build-isolation --verbose --editable .

Older versions of setuptools could probably be supported in flashinfer by casting the collected paths in setup.py to strings.

If its not a priority, hopefully this issue saves someone else some frustration

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

No branches or pull requests

1 participant