Skip to content

Add runtime restart warning to prevent NumPy import error#56

Open
Amrit-R-M wants to merge 2 commits into
facebookresearch:mainfrom
Amrit-R-M:fix/colab-runtime-restart-warning
Open

Add runtime restart warning to prevent NumPy import error#56
Amrit-R-M wants to merge 2 commits into
facebookresearch:mainfrom
Amrit-R-M:fix/colab-runtime-restart-warning

Conversation

@Amrit-R-M

Copy link
Copy Markdown

Problem

Fixes #27

Users running the demo notebook in Google Colab encounter ImportError: cannot import name '_center' when importing tribev2 after installation. This happens because NumPy 2.2.6 is installed during setup, but the old NumPy binaries remain loaded in memory until the runtime is restarted.

Solution

Added a clear warning callout immediately after the installation cell that:

  • Instructs users to restart the Colab runtime before continuing
  • Explains why the restart is necessary (NumPy version update)
  • Shows the exact error message they'll encounter if they skip this step

The warning is placed in a blockquote format to make it visually distinct and impossible to miss.

Testing

  • Verified the warning renders correctly in Jupyter/VS Code notebook viewer
  • Confirmed the markdown formatting displays properly

Addresses issue facebookresearch#27 by adding a clear warning in the notebook
instructing Colab users to restart runtime after installation.
This prevents the 'ImportError: cannot import name _center'
error caused by NumPy version mismatch.
Copilot AI review requested due to automatic review settings April 26, 2026 15:46
@meta-cla

meta-cla Bot commented Apr 26, 2026

Copy link
Copy Markdown

Hi @amritmundlapudibiz-eng!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copilot AI 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.

Pull request overview

Adds a prominent post-installation warning in the Colab demo notebook to reduce user confusion and prevent the common NumPy binary mismatch import failure after installing tribev2.

Changes:

  • Inserted a new markdown callout immediately after the install cell instructing Colab users to restart the runtime.
  • Explained the restart rationale (NumPy upgrade) and referenced the resulting import error if skipped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tribe_demo.ipynb Outdated
">\n",
"> `Runtime → Restart runtime`\n",
">\n",
"> This ensures NumPy 2.2.6 loads correctly. Skipping this step causes `ImportError: cannot import name '_center'`."

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

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

The PR description says the warning shows the exact error message users will see, but the notebook only includes the truncated ImportError: cannot import name '_center'. Consider updating this to match the full error from #27 (including the from 'numpy._core.umath' part) so users can recognize it precisely.

Copilot uses AI. Check for mistakes.
Comment thread tribe_demo.ipynb
Comment thread tribe_demo.ipynb Outdated
">\n",
"> `Runtime → Restart runtime`\n",
">\n",
"> This ensures NumPy 2.2.6 loads correctly. Skipping this step causes `ImportError: cannot import name '_center'`."

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

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

Hardcoding NumPy 2.2.6 in the warning means the notebook text will need updating whenever the dependency pin changes. Consider wording this as “the NumPy version installed/updated by the install cell” (or referencing the version dynamically) to reduce maintenance overhead.

Copilot uses AI. Check for mistakes.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 26, 2026
@meta-cla

meta-cla Bot commented Apr 26, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@txshah

txshah commented May 21, 2026

Copy link
Copy Markdown

great pr! fixed my issue loading the collab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

not resolving imports in the ipynb notebook

3 participants