This topic provides DP0 Delegates and Rubin Science Platform users with steps to help them recover from a commonly-encountered issue with package imports.
The Problem: In this case the problem manifests when a package cannot be properly imported. This leads to an
ImportError for which the last line of the traceback actually points to the file it is trying to import from, and it is in the users
If a user sees a mention of
.local anywhere in the exception, there is a chance they have installed packages that are polluting stack environments, and this is a big red flag that following the solution below will be necessary.
However, this is not the only way this problem can manifest, as issues with user-installed packages can be hard to track down. E.g., it might import fine, but then not be able to find an attribute or method on a particular object.
The Solution: Users should exit the RSP and then clear their
.local file when they log back in to the Notebook Aspect by checking the box “Clear .local directory (caution!)” on the Hub spawner page (see image below). This option is simple and effective, and also helps in cases where the user-installed packages are keeping JupyterLab from starting.
An Alternative Solution: The user should first close and shutdown the notebook (or, e.g., ipython session) which is experiencing the error, and then launch a terminal in the Notebook Aspect and move their
.local file out of the way by renaming it as something else, such as:
mv ~/.local ~/.local_[YYYY][MM][DD]
There will be no need to recreate the
.local directory after this. The user should then restart the notebook (or, e.g., ipython session) and try to import the packages.