Skip to content

[CuTeDSL] Fix incorrect package-data key in pyproject.toml#3145

Open
Johnsonms wants to merge 1 commit intoNVIDIA:mainfrom
Johnsonms:fix/cutlass-dsl-pyproject-package-data
Open

[CuTeDSL] Fix incorrect package-data key in pyproject.toml#3145
Johnsonms wants to merge 1 commit intoNVIDIA:mainfrom
Johnsonms:fix/cutlass-dsl-pyproject-package-data

Conversation

@Johnsonms
Copy link
Copy Markdown
Contributor

Summary

Fix incorrect package-data key in python/CuTeDSL/pyproject.toml that caused missing shared libraries (lib/*.so) in built distributions, leading to cutlass being non-importable.


Problem

The [tool.setuptools.package-data] section in python/CuTeDSL/pyproject.toml used an incorrect key:

[tool.setuptools.package-data]
nvidia_cutlass_dsl = ["lib/**/*"]  # incorrect

This key must match the Python package name, not the PyPI distribution name. Since the installed package is cutlass (not nvidia_cutlass_dsl), setuptools silently ignored this entry.

As a result:

  • Required shared libraries (lib/*.so) were not included in the built wheel
  • The installed package was incomplete
  • Importing cutlass failed at runtime

Root Cause

pyproject.toml defines:

[project]
name = "nvidia-cutlass-dsl"        # PyPI distribution name

[tool.setuptools]
packages = ["cutlass"]             # Python package name

These are different concepts:

  • Distribution name → used by pip install
  • Package name → used by Python (import cutlass)

[tool.setuptools.package-data] maps package names → file globs, so the key must be cutlass.


Fix

Update the key to match the Python package name:

[tool.setuptools.package-data]
cutlass = ["../lib/**/*"]

How This Was Discovered

This issue was identified while working with FlashAttention, which depends on nvidia-cutlass-dsl for its CuTeDSL-based FlashAttention-4 implementation.


Steps to Reproduce

git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention
pip install -e "flash_attn/cute[dev,cu13]"

Then:

python3 -c "import cutlass; print(cutlass.__file__)"

Observed error:

ModuleNotFoundError: No module named 'cutlass'

Investigation

After installing nvidia-cutlass-dsl==4.4.2, the cutlass module was not importable despite the package being installed.

Inspection revealed:

  • nvidia_cutlass_dsl.pth listed in RECORD but not written to disk → Python path not updated
  • cutlass/ package files listed in RECORD but missing from installation

This indicates an incomplete/corrupted wheel, consistent with setuptools skipping package-data due to the incorrect key.


Workaround

Until a fixed wheel is published:

pip install --force-reinstall nvidia-cutlass-dsl-libs-base==4.4.2

This forces reinstallation and restores the missing files.


Impact

This affects:

  • Direct users of the CuTeDSL Python DSL
  • Downstream projects depending on nvidia-cutlass-dsl (e.g., FlashAttention-4)

Users may encounter:

ModuleNotFoundError: No module named 'cutlass'

immediately after installation.

The [tool.setuptools.package-data] section referenced 'nvidia_cutlass_dsl'
which does not match any package being built. The installed package name is
'cutlass' (as declared in [tool.setuptools] packages), so setuptools silently
ignored the entry and never included lib/*.so files in built distributions.
@fcbruce
Copy link
Copy Markdown

fcbruce commented Apr 7, 2026

Hi @Johnsonms, thanks for the PR and the detailed investigation!

Could you confirm — did you encounter this issue specifically after upgrading from an older version (e.g., < 4.4.0) to 4.4.x+? Or did you see it on a fresh install as well?

This would help us determine whether your pyproject.toml fix fully addresses the root cause, or if there's an additional packaging/cleanup issue during the upgrade path that needs to be handled separately.

@Johnsonms
Copy link
Copy Markdown
Contributor Author

Hi @Johnsonms, thanks for the PR and the detailed investigation!

Could you confirm — did you encounter this issue specifically after upgrading from an older version (e.g., < 4.4.0) to 4.4.x+? Or did you see it on a fresh install as well?

This would help us determine whether your pyproject.toml fix fully addresses the root cause, or if there's an additional packaging/cleanup issue during the upgrade path that needs to be handled separately.

Thanks @fcbruce for checking. The issue reproduces on a fresh install — the wheel built from this repo is missing the lib/*.so files regardless of upgrade history, because setuptools silently ignores the package-data key when it doesn't match the actual package name. So the pyproject.toml fix fully addresses the root cause. An upgrade from an older version wouldn't help either, as the broken wheel would overwrite the correct files.

@fcbruce
Copy link
Copy Markdown

fcbruce commented Apr 9, 2026

Hi @Johnsonms,

I executed your commands and I cannot reproduce this issue with a fresh install.

git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention
pip install -e "flash_attn/cute[dev,cu13]"

This command installs Cutlass DSL from PyPI prebuilt wheel https://github.com/Dao-AILab/flash-attention/blob/15270e66dc88d70d08f6ba6003eb17e7307149b0/flash_attn/cute/pyproject.toml#L35

I can only reproduce this issue when upgrading Cutlass DSL from a older version(< 4.4.0). It could be related with this issue #3132

Could you please more details about your environment? For example, python version, platform(x86_64/aarch64), pip list result before installing Cutlass DSL, etc. So that it could help us understand what is the root cause of this issue.

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.

2 participants