Skip to content

Drop the pip-installed cmake from the pytorch base image - #48

Merged
rcannood merged 1 commit into
mainfrom
fix-pytorch-cmake-shim
Aug 13, 2026
Merged

Drop the pip-installed cmake from the pytorch base image#48
rcannood merged 1 commit into
mainfrom
fix-pytorch-cmake-shim

Conversation

@rcannood

Copy link
Copy Markdown
Member

This PR makes cmake usable again in base_pytorch_nvidia.

The nvcr image runs pip install cmake, which puts cmake, cpack and ctest shims in
/usr/local/bin. Those shadow apt's /usr/bin/cmake, because /usr/local/bin comes first
on PATH. The shims themselves look fine -- cmake --version works -- but they break as
soon as a build calls them from inside a pip build isolation environment, where
site-packages is no longer on sys.path:

File "/usr/local/bin/cmake", line 3, in <module>
    from cmake import cmake
ModuleNotFoundError: No module named 'cmake'

Reproduced on the published image, where it stops cellplm from building louvain:

docker run --rm --entrypoint bash openproblems/base_pytorch_nvidia:1 -c 'pip install cellplm'
# ERROR: Failed building wheel for louvain

Changes:

  • Install cmake via apt and pip uninstall -y cmake. Uninstalling the package rather than
    removing the one shim also clears cpack and ctest, which would otherwise be left
    behind pointing at nothing.
  • Add test_cmake.py, checking that all three resolve to the apt-provided binaries.

viash test passes 3/3, and pip install cellplm now gets through louvain-0.7.1. With
this in, the workaround in the cellplm component (apt: [cmake] plus
rm -f /usr/local/bin/cmake) can go.

🤖 Generated with Claude Code

* Install cmake via apt and uninstall the pip package. Its shims in
  /usr/local/bin shadow /usr/bin/cmake, and they fail with
  ModuleNotFoundError when a build calls them from inside a pip build
  isolation environment -- which is why `pip install cellplm` could not
  build louvain.
* Add a test checking that cmake, cpack and ctest resolve to /usr/bin
* Bump the version to 1.2.0
@rcannood
rcannood merged commit 38ccb73 into main Aug 13, 2026
5 checks passed
@rcannood
rcannood deleted the fix-pytorch-cmake-shim branch August 13, 2026 17:35
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.

1 participant