Add runtime restart warning to prevent NumPy import error#56
Conversation
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.
|
Hi @amritmundlapudibiz-eng! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
There was a problem hiding this comment.
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.
| ">\n", | ||
| "> `Runtime → Restart runtime`\n", | ||
| ">\n", | ||
| "> This ensures NumPy 2.2.6 loads correctly. Skipping this step causes `ImportError: cannot import name '_center'`." |
There was a problem hiding this comment.
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.
| ">\n", | ||
| "> `Runtime → Restart runtime`\n", | ||
| ">\n", | ||
| "> This ensures NumPy 2.2.6 loads correctly. Skipping this step causes `ImportError: cannot import name '_center'`." |
There was a problem hiding this comment.
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.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
…ric NumPy version
|
great pr! fixed my issue loading the collab |
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:
The warning is placed in a blockquote format to make it visually distinct and impossible to miss.
Testing