Skip to content

fix(install): avoid apt-package uninstall failure during web dep install#371

Merged
ChuckBuilds merged 2 commits into
ChuckBuilds:mainfrom
rpierce99:fix/install-ignore-installed-requests
Jun 15, 2026
Merged

fix(install): avoid apt-package uninstall failure during web dep install#371
ChuckBuilds merged 2 commits into
ChuckBuilds:mainfrom
rpierce99:fix/install-ignore-installed-requests

Conversation

@rpierce99

@rpierce99 rpierce99 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Note

Untested on a fresh install. This PR is Claude's interpretation of an issue raised in Discord (a fresh Pi install failing at step 7). The reasoning and fix are explained below, but I have not reproduced the failure or verified the fix on a clean Raspberry Pi OS image. Please review/test before merging.

Problem

On a fresh Raspberry Pi install, step 7 ("Install web interface dependencies") aborts with:

× Cannot uninstall requests 2.32.3
╰─> The package's contents are unknown: no RECORD file was found for requests.
  hint: The package was installed by debian.
✗ An error occurred during: Install web interface dependencies

Why it happens

  1. install_dependencies_apt.py installs requests via apt → python3-requests (2.32.3). Debian-packaged Python modules ship no pip RECORD file.
  2. Later it pip-installs google-api-python-client. Its dependency tree pulls a newer requests, and pip's resolver tries to uninstall the apt copy to replace it.
  3. pip can't uninstall an apt-managed package with no RECORD → uninstall-no-record-file → the whole install aborts.

Fix

Add --ignore-installed to install_via_pip. pip then installs the new version into /usr/local/lib/.../dist-packages (which shadows the apt copy on Debian) instead of trying to remove the apt-managed package. This resolves the failure for any transitive dependency pip needs to upgrade over an apt-installed package, not just requests.

Manual workaround (for anyone hitting this now)

python3 -m pip install --break-system-packages --ignore-installed --prefer-binary \
  'requests>=2.33.0,<3.0.0' \
  'google-api-python-client>=2.147.0,<3.0.0' \
  'google-auth-oauthlib>=1.2.0,<2.0.0' \
  'google-auth-httplib2>=0.2.0,<1.0.0'
# then re-run (idempotent): bash first_time_install.sh

Testing

Byte-compiled and functionally verified that install_via_pip now emits --break-system-packages --prefer-binary --ignore-installed. Not validated end-to-end on a fresh Pi image (see note above).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced dependency installation process to prevent conflicts when mixing system package manager and pip installations, improving installation reliability.

On a fresh Pi install, requests is installed via apt (python3-requests),
which ships no pip RECORD file. When pip later installs
google-api-python-client, its dependency tree pulls a newer requests and
attempts to uninstall the apt copy, failing with "uninstall-no-record-file"
and aborting the whole install at step 7 (web interface dependencies).

Add --ignore-installed to install_via_pip so pip lays the new version down
in /usr/local (shadowing the apt copy) instead of trying to remove an
apt-managed package. This resolves the failure for any transitive
dependency pip needs to upgrade over an apt-installed package, not just
requests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rpierce99, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes and 49 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17424399-28a8-4abb-b432-2199ce1cac2b

📥 Commits

Reviewing files that changed from the base of the PR and between fa6a7d6 and a108e2b.

📒 Files selected for processing (1)
  • scripts/install_dependencies_apt.py
📝 Walkthrough

Walkthrough

Adds --ignore-installed to the pip install command in install_via_pip() within scripts/install_dependencies_apt.py. The function's docstring is expanded to explain that this flag prevents pip from aborting due to missing RECORD metadata on apt-managed packages and avoids uninstalling those packages when newer pip versions are installed.

Changes

pip --ignore-installed flag

Layer / File(s) Summary
Add --ignore-installed flag and expand docstring
scripts/install_dependencies_apt.py
install_via_pip() now passes --ignore-installed to pip alongside --break-system-packages and --prefer-binary; the docstring is extended to document this new flag's purpose.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding --ignore-installed flag to prevent pip from uninstalling apt-managed packages during dependency installation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production

codacy-production Bot commented Jun 14, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/install_dependencies_apt.py (1)

211-211: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add --ignore-installed to the rgbmatrix pip install for consistency.

The rgbmatrix installation command should include --ignore-installed for the same reason as the main install_via_pip() function: to prevent failures when pip needs to upgrade apt-managed dependencies. While failures here are tolerated (lines 215-221), using the flag prevents unnecessary errors and maintains consistency with the fix.

🔧 Proposed fix
-                ok, output = _run([sys.executable, '-m', 'pip', 'install', '--break-system-packages', str(rgbmatrix_path)])
+                ok, output = _run([sys.executable, '-m', 'pip', 'install', '--break-system-packages', '--ignore-installed', str(rgbmatrix_path)])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install_dependencies_apt.py` at line 211, The rgbmatrix pip install
command at the _run() call for installing from rgbmatrix_path is missing the
--ignore-installed flag. Add --ignore-installed to the pip command arguments
(between 'install' and '--break-system-packages') to maintain consistency with
the main install_via_pip() function and prevent unnecessary pip failures when
upgrading apt-managed dependencies.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@scripts/install_dependencies_apt.py`:
- Line 211: The rgbmatrix pip install command at the _run() call for installing
from rgbmatrix_path is missing the --ignore-installed flag. Add
--ignore-installed to the pip command arguments (between 'install' and
'--break-system-packages') to maintain consistency with the main
install_via_pip() function and prevent unnecessary pip failures when upgrading
apt-managed dependencies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ff536e14-8ad1-4b03-821a-129814d5fe8b

📥 Commits

Reviewing files that changed from the base of the PR and between d22d0a3 and fa6a7d6.

📒 Files selected for processing (1)
  • scripts/install_dependencies_apt.py

Keeps the rgbmatrix pip install consistent with install_via_pip so it
won't fail trying to uninstall an apt-managed dependency either.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rpierce99

Copy link
Copy Markdown
Contributor Author

Good catch @coderabbitai — applied --ignore-installed to the local rgbmatrix pip install too (a108e2b) for consistency. It's low-risk there since that block already guards with check_package_installed('rgbmatrix') and tolerates failure, but it keeps the behavior uniform.

Reminder for reviewers: per the PR note, this is still untested on a fresh Pi install — it's reasoned from the Discord error, not reproduced.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@rpierce99 Thanks for the follow-up! Applying --ignore-installed to the rgbmatrix block too makes sense for consistency — and as you note, the existing guard + failure tolerance keeps any risk negligible there.

Good call flagging the "reasoned, not reproduced" status for reviewers. If someone can spin up a fresh Raspberry Pi OS image to do an end-to-end smoke test before merge, that would be the ideal validation path for both the main install_via_pip fix and the rgbmatrix change.

(ᵔ◡ᵔ)🐇

@ChuckBuilds ChuckBuilds merged commit 974d7ea into ChuckBuilds:main Jun 15, 2026
3 checks passed
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