fix: use canonical package name torch-tb-profiler in Tensorboard panel#281
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
%pip install torch_tb_profilerto%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 usesRequirement.namewhich does not normalize underscores to dashes, butpip freezeoutputs the canonical PyPI nametorch-tb-profiler(dashes). This mismatch caused the already-installed check to always returnFalse, 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:Using the canonical dash-separated name fixes the installed check so pip only runs once on a fresh container.
Test plan
Installing packages...spinner only appears on first-ever load (not on subsequent widget interactions)Unable to acquire lock for pip installererrorsRelates to CUST-5526.
🤖 Generated with Claude Code