Once in a while, I find myself updating outdated packages on my Linux system. About a month ago, I decided to run the command...
sudo pip list --outdated --format=freeze | awk -F '==' '{printf "%s ", $1}' |
xargs sudo pip install --upgrade --ignore-installed
This resulted in all my system-installed python packages being updated.
Ok, what's the problem? you might ask
The problem
The problem is that now when the system's package manager attempts to update one of those packages, it fails because it detects that the package has been modified since it was last updated. This is a smart move by the package manager in order to avoid overwriting those changes in case they were intentional, but the downside of this is that now I cannot update other packages which may depend on the ones I just upgraded using pip.I experienced this issue today when I tried to use jupyterlab and suddenly, I was getting a terminal full of errors:
ImportError: cannot import name 'callback_prototype' from 'backcall' (unknown location)
[I 09:47:20.548 LabApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.8/site-packages/ipykernel_launcher.py", line 15, in
from ipykernel import kernelapp as app
File "/usr/lib/python3.8/site-packages/ipykernel/__init__.py", line 2, in
from .connect import *
File "/usr/lib/python3.8/site-packages/ipykernel/connect.py", line 13, in
from IPython.core.profiledir import ProfileDir
File "/home/chigozirim/.local/lib/python3.8/site-packages/IPython/__init__.py", line 56, in
from .terminal.embed import embed
File "/home/chigozirim/.local/lib/python3.8/site-packages/IPython/terminal/embed.py", line 15, in
from IPython.core.interactiveshell import DummyMod, InteractiveShell
File "/home/chigozirim/.local/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 43, in
from IPython.core.events import EventManager, available_events
File "/home/chigozirim/.local/lib/python3.8/site-packages/IPython/core/events.py", line 16, in
from backcall import callback_prototype
Fixing the problem
In order to fix this issue, I had to basically reinstall jupyterlab along with all of its dependencies just to make sure that everything it depended on was still working as expected.
The above command replaced all the dependencies of jupyterlab so now I don't see any errors when I run the command again.
pactree -u jupyterlab | xargs echo | sudo xargs pacman --asdeps -Sy --noconfirm --overwrite '*'
The above command replaced all the dependencies of jupyterlab so now I don't see any errors when I run the command again.
Avoiding the problem
In order to avoid having to deal with this again, I have done the following:


0 comments:
Post a Comment