No module named "netifaces" during "Vagrant Up"

2.1k Views Asked by At

When I do vagrant up, I get the following error:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mv -f '/tmp/vagrant-network-entry-1624290630' '/etc/netplan/50-vagrant.yaml'
chown root:root '/etc/netplan/50-vagrant.yaml'
chmod 0644 '/etc/netplan/50-vagrant.yaml'
netplan apply

Stdout from the command:



Stderr from the command:

Traceback (most recent call last):
  File "/usr/sbin/netplan", line 20, in <module>
    from netplan import Netplan
  File "/usr/share/netplan/netplan/__init__.py", line 18, in <module>
    from netplan.cli.core import Netplan
  File "/usr/share/netplan/netplan/cli/core.py", line 24, in <module>
    import netplan.cli.utils as utils
  File "/usr/share/netplan/netplan/cli/utils.py", line 25, in <module>
    import netifaces
ModuleNotFoundError: No module named 'netifaces'

I've already `sudo -H pip3 install netifaces', and that didn't seem to resolve the issue. Thanks!

2

There are 2 best solutions below

0
On

sudo -H will install for the current user. For netplan to work, it should be installed for root.

Install the package for root:

sudo python3 -m pip install --force-reinstall --no-cache-dir netifaces
0
On

You can try sudo apt-get update -y and then sudo apt-get install -y python3-netifaces