Skip to content

fix: use canonical package name torch-tb-profiler in Tensorboard panel#281

Merged
smiller-comet merged 1 commit into
masterfrom
fix/tensorboard-panel-pip-package-name
Apr 15, 2026
Merged

fix: use canonical package name torch-tb-profiler in Tensorboard panel#281
smiller-comet merged 1 commit into
masterfrom
fix/tensorboard-panel-pip-package-name

Conversation

@smiller-comet
Copy link
Copy Markdown
Contributor

Summary

  • Changes %pip install torch_tb_profiler to %pip install torch-tb-profiler (underscores → dashes)

Why

The panel engine's is_pip_installed_package() checks whether a package is already installed before running pip. It uses Requirement.name which does not normalize underscores to dashes, but pip freeze outputs the canonical PyPI name torch-tb-profiler (dashes). This mismatch caused the already-installed check to always return False, so pip install re-ran on every Streamlit script execution — even after the package was already installed.

Under normal conditions this showed up as the Installing packages... spinner appearing twice per panel load. Under heavy load (e.g. 64 × 100MB trace files causing slow init and concurrent Streamlit re-runs), multiple processes would pile up waiting for the global pip lock and eventually hit the retry limit, producing:

Unable to acquire lock for pip installer; try again later

Using the canonical dash-separated name fixes the installed check so pip only runs once on a fresh container.

Test plan

  • Open the TensorboardTorchProfilerViewer panel on an existing project
  • Confirm Installing packages... spinner only appears on first-ever load (not on subsequent widget interactions)
  • Confirm no Unable to acquire lock for pip installer errors

Relates to CUST-5526.

🤖 Generated with Claude Code

The %pip install magic command was using torch_tb_profiler (underscores),
but pip freeze outputs the canonical PyPI name torch-tb-profiler (dashes).
The panel engine's is_pip_installed_package() uses Requirement.name which
does not normalize underscores to dashes, so the already-installed check
always returned False — causing pip install to re-run on every Streamlit
script execution.

This resulted in the global pip lock (/home/stuser/pip.lock) being held
repeatedly, causing lock contention when multiple Streamlit re-runs
happened concurrently (e.g. from streamlit_js_eval callbacks or large
trace file downloads). Under heavy load this produced the visible error:
"Unable to acquire lock for pip installer; try again later".

Fix: use the canonical dash-separated name so the installed check works
correctly after the first install.

Relates to CUST-5526.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@smiller-comet smiller-comet merged commit 55dd6aa into master Apr 15, 2026
34 of 51 checks passed
@smiller-comet smiller-comet deleted the fix/tensorboard-panel-pip-package-name branch April 15, 2026 20:41
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