tkn-tub / ns3-gym

ns3-gym - The Playground for Reinforcement Learning in Networking Research
GNU General Public License v2.0
521 stars 197 forks source link

Error: No module named 'ns3gym.messages_pb2' #1

Closed huckiyang closed 5 years ago

huckiyang commented 5 years ago

Dear ns3-gym team,

really nice work, but I bumped into a problem when I try $ env = gym.make('ns3-v0')

import ns3gym.messages_pb2 as pb

ModuleNotFoundError: No module named 'ns3gym.messages_pb2' with these error messages and could not empower the env any further.

I guess the messages_pd2 is this one below, but don't know where shall it be put. https://github.com/grpc/grpc/blob/master/test/http2_test/messages_pb2.py

Any suggestion? noted I clone the ns3-gym with the version and followed your read.me just today - 10/22. Cheers

pgawlowicz commented 5 years ago

Hi,

Thank you for pointing out this issue.

The readme file was simply wrong, and I have already fixed it (swapped points 3 and 4). First, you have to run: ./waf configure that generates both C++ and Python Protocol Buffer messages and only then you can install python module using: pip3 install ./src/opengym/model/ns3gym

In addition, I have added some more checks to prevent installing python module without messages_pb2.py file as well as forcing to use protoc compiler in version 3.

Best, Piotr

huckiyang commented 5 years ago

Dear Piotr

thanks for the kind reply, I will try your solution. I manually added the messages_pb2.py a few hours ago. in the path

python3.6/site-packages/ns3gym/

the error message seems to disappear. btw, does it take a long while to initiate the gym.make('ns3-v0'), more than 10min?

pgawlowicz commented 5 years ago

Hi, Probably ns3 project is being built during this long time. You should build the project before using: ./waf build

If you install the ns3gym python module inside a virtual environment, you have to build ns3 in the same virtual env, using ./waf build

However, the build is done only once and then examples should run immediately.

BR, Piotr