noxrepo / pox

The POX network software platform
https://noxrepo.github.io/pox-doc/html/
Apache License 2.0
619 stars 470 forks source link

Import "pox.core" could not be resolved #285

Closed inadquatecoding closed 1 year ago

inadquatecoding commented 1 year ago

I'm trying to modify the L2_learning script, and re-implement a portion of L2_learning myself using Pox.

"When controler sees a packet with destination address Y, source address X and source port P, controller will lean that a packet from address X arrived at port P, then if a packet arrives with destination X, it will be sent through port P."

I digress, when I try opening the example L2_learning script in Visual studio code, the IDE does not see the libraries being imported.

I have ran

pip install pox
pip3 install pox

and both result in

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pox in ./.local/lib/python3.10/site-packages (0.3.2)

However Pylance is not seeing the packages existing, even after a machine restart. Is there something I've missed in getting these libraries? I have pox installed.

inadquatecoding commented 1 year ago

I have resolved this issue, for reference I am using Python 3.10.7, on Ubuntu.

The problem here was that the pox installation directory wasn't added to my PYTHONPATH. What you need to do is

  1. Figure out where your python installation looks for site packages if not obvious. python -m site --user-site

  2. Go to the site packages directory (yours might be different) cd /home/user.local/lib/python3.10/site-packages

  3. Create a .pth file here and add your pox directory. This does it in one line. echo "/home/user/Downloads/pox" > pox.pth

This resolves the problem of missing libraries.

Previous issue was #262