3

I'm trying to run a python code that imports mininet. I got the error

ModuleNotFoundError: No module named 'mininet.net' 

I tried to add mininet from the interpreter but there are only ipmininet (which keeps fail in installing) and mininet-topology-yaml. Any idea how to solve this issue? How I can add mininet to pycharm?

Thanks in advance.

martineau
  • 119,623
  • 25
  • 170
  • 301
Sana'a Ala'a
  • 163
  • 2
  • 10
  • This is probably not a 'PyCharm' issue but rather an issue with your environment. Are you running this on a MiniNet VM? Is the package available when you run Python directly from the command line? – Grismar Aug 30 '19 at 00:30
  • sorry but I'm really new to Linux, so can you simplify what you are aiming for? – Sana'a Ala'a Aug 30 '19 at 00:34
  • I'm running ubuntu on a virtual machine and mininet is on the same VM – Sana'a Ala'a Aug 30 '19 at 00:35
  • Have you gone through a basic 'getting started'? Are you running into any issues during that? https://github.com/mininet/mininet/wiki/Introduction-to-Mininet – Grismar Aug 30 '19 at 01:01

2 Answers2

3

I solved the problem. The PyCharm Python interpreter should be python 2 not any other version.

Someone may need this answer in the future!!

Sana'a Ala'a
  • 163
  • 2
  • 10
1

I would like to correct the fact that the python 2 does not have to be used. For some reason, installing from packages only installs in the python 2 library directory and not python 3. But when installing from source you can control this behavior.

To install mininet with python 3 directories, follow the official installation guide from source, but before running the install.sh script, prefix it with the statement PYTHON=python3. So your installation command will be PYTHON=python3 ./install.sh

Here's the line of code that checks what python version is installed

rsn
  • 369
  • 1
  • 3
  • 17