No module named 'core' when using pyping for Python 3

You can use ping3 library. But it requires root permission on your machine. This link shows the workaround (unprivileged ICMP sockets which allow to use ping without root).


This is because of absolute imports being in effect (more precisely, the lack of implicit relative imports) for Python 3 and the fact that the pyping module was most likely only written for Python 2. Whereas in Python 2 you can do:

from core import *

In Python 3 (or if you have from __future__ import absolute_import in Python 2), you have to do:

from .core import *

or

from pyping.core import *

You have two options:

  1. ask the module author to make it compatible with Python 3
  2. fork it yourself and make it compatible with Python 3 (you can look into using 2to3 for this)