I started the upgrade from Ubuntu 18.04 to 20.04 today and got a bit of a surprise when trying to install PIP so I could use the MaxMind geolite2 package:
root@ubuntu-rr58:/home/me# apt install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
The root problem here is Python 2 went EoS in January 2020 and does not ship with Ubuntu 20. But, there is a hack to load certain Python 2 packages…
First, install python3-pip:
apt install python3-pip
Then try to install the python2 packages you’re looking for:
pip3 install python-geoip pip3 install python-geoip-geolite2
Now, install Python 2.7:
sudo apt install python2
In your script, use sys.path.insert to add the Python3 packages directory.
#!/usr/bin/env python2 from __future__ import print_function import sys sys.path.insert(1, '/usr/local/lib/python3.8/dist-packages/') from geoip import geolite2
A better solution for this particular issue was migrate from geoip-geolite2 to , which is fully python3.