The access to the anaconda "main" channel has been blocked due to licensing changes:
https://www.anaconda.com/blog/update-on-anacondas-terms-of-service-for-academia-and-research
You need to completely remove the main channel from your personal config, i.e., from ~/.condarc
.
In the channels
section, the main channel is usually called defaults
or given as two URLs:
Instead, you need to insert conda-forge
into the channel list if it is not already on the list.
You can use the following command to check if your config is correct:
conda config --show-sources
The output should not contain any variant of the main channel.
If you do not have a ~/.condarc
, you need to create the file with the following contents:
report_errors: false
channels:
- conda-forge
For new installations, it is easiest to use miniforge, which is miniconda where defaults
is replaced by conda-forge
out of the box:
There are three common problems that cause Jupyter plots via matplotlib to not work properly (usually no zooming) or to not appear at all (“model not found”).
- A. Version mismatches between your env and the env that runs Jupyter(Hub).
- B. pip-installed packages in your home folder that overlay the correct packages in your env.
- C. Residual misconfiguration in your home folder.
Regarding A., consult the following table of versions that should work together: https://matplotlib.org/ipympl/installing.html#compatibility-table
Regarding B., note that pip-installed package only distinguish by Python version. This means that for two envs that use the same Python version, you can accidentally cross-pollute the other env with pip-installed packages. This can lead to weird results.
The following describes how to debug your problem.
Getting Started
Create a new notebook with this minimal example:
%matplotlib widget
from matplotlib import pyplot as plt
plt.figure()
plt.plot([1, 2, 1])
plt.show()
- Run it with your desired kernel. If this works, your setup is correct. If you have a more complex example that does not work, the problem should be searched in that code.
- Select the kernel that runs JupyterHub. This is indicated by an asterisk after the name in the drop-down menu. At the time of writing this, this is
jupyterhub-5.2.1_lab4_py3.13
. Run the minimal example with that kernel. If this works, you likely have a version mismatch in your kernel (Case A). If this does not work, the issue is likely in your home folder (Cases B and C). - Try the same with a few Ra-Standard (
conda-ra-standard_py3*
) kernels that have a Python version different from the JupyterHub kernel. These have been checked to work correctly. It is unlikely (but still possible) that you have made a pip mess™ with many different Python versions. Take note of which Python version works and which does not as it tells you where you need to clean up.
Version Mismatch
- Create two notebooks:
- One running your desired kernel.
- One running a Ra-Standard kernel, preferably with the same Python version as your kernel.
- Check the versions of the relevant packages for both:
!conda list | grep -E 'ipy|jupyter|matplotlib|mpl'
- Compare the two lists and adjust the versions installed in your desired kernel to match the Ra-Standard kernel.
- Try if plotting works with the minimal example.
Home Folder Mess
First Step
- Stop your Jupyter spawner.
- Logging out of Jupyterhub is NOT enough!
- Click on File -> Hub Control Panel -> Stop My Server.
Sledgehammer Method
- Do the First Step!
- ssh to Ra.
- Rename
.local
:mv ~/.local ~/.local-bak
- Restart Jupyter and try if plotting works with the minimal example.
- You can stop here if plotting works and you are sure nothing in
.local-bak
is still needed. In that case, you can also delete~/.local-bak
. - If plotting still does not work, the problem is beyond this document. Call for help!
- If you still need something in
.local
, undo the above:- Do the First Step again.
- Delete the newly created
.local
(be sure to type this correctly):rm -rf ~/.local
- Move the backed-up
.local
back in place:mv ~/.local-bak ~/.local
- Read Scalpel Method.
Scalpel Method
- Create a new notebook with the desired kernel. (Note: You can also do the following from an ssh session to Ra after doing the First Step and activating the desired env.)
- Get the list of pip-installed packages relevant for jupyter and/or plotting in your environment:
!conda list | grep pypi | grep -E 'ipy|jupyter|matplotlib|mpl'
- Use pip to check which of these packages are in
.local
:!pip show <package> | grep Location
- Remove the packages from
.local
:!pip uninstall <package>
- Once this clean-up is done, try if plotting works with the minimal example.
- If there are no (more) pip-installed packages and the plotting still does not work, the problem likely lies in the Jupyter configuration files in
.local
:- Do the First Step!
- ssh to Ra.
cd ~/.local/share
mv jupyter jupyter-bak
- Restart jupyter and try if plotting works with the minimal example.
- You can stop here if plotting works. In that case, you can also delete
~/.local/share/jupyter-bak
. - If plotting still does not work, the problem is beyond this document. Call for help!