pip on a Mininet host cant find installed packages
I have Mininet on a VM, I installed a package called wsproto
using pip
, but when I try to use that package from inside a Mininet host I get an error indicating that the package is missing:
Traceback (most recent call last):
File "examples/http3_server.py", line 10, in <module>
import wsproto
ModuleNotFoundError: No module named 'wsproto'
It turns out that the packages available for the Mininet host are far less than the packages actually installed on the system!
My Question: How do I install a Python package and make it available for Mininet?
I am running on Ubuntu 20.04, using Python 3.8.10:
$ whereis python3
python3: /usr/bin/python3.8-config /usr/bin/python3 /usr/bin/python3.8 /usr/lib/python3 /usr/lib/python3.8 /usr/lib/python3.9 /etc/python3 /etc/python3.8 /usr/local/lib/python3.8 /usr/include/python3.8 /usr/share/python3 /usr/share/man/man1/python3.1.gz
and on Mininet:
h1 whereis python3
python3: /usr/bin/python3.8-config /usr/bin/python3 /usr/bin/python3.8 /usr/lib/python3 /usr/lib/python3.8 /usr/lib/python3.9 /etc/python3 /etc/python3.8 /usr/local/lib/python3.8 /usr/include/python3.8 /usr/share/python3 /usr/share/man/man1/python3.1.gz
I figured out the solution, I had to use sudo
like so:
sudo pip install wsproto