tkn-tub / ns3-gym

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

The `info` returned by `step()` must be a python dictionary, actual type: <class 'str'> #89

Open GeorgeFrangulea opened 1 year ago

GeorgeFrangulea commented 1 year ago

Hello,

Did anyone encounter the below error? I have re-did my anaconda env and I do not know what I changed but my code does not compile anymore. Keeps coming with these warning that suggests the ns3 env needs upgraded but this was not the case few days ago. I would be very grateful if anyone could let me know the right python version to use, TensorFlow, gym etc. Thanks. BR, George

Channel: 1 CCA: 1 RxPower: -56.6436 Channel: 2 CCA: 0 RxPower: -76.9897 Channel: 3 CCA: 0 RxPower: -76.9897 MyGetObservation: [0, 1, 0, 0] MyGetReward: -1 MyGetGameOver: 0 MyGetExtraInfo: info /home/dawn_redwood/anaconda3/envs/ns-3.39.1/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:219: DeprecationWarning: WARN: Core environment is written in old step API which returns one bool instead of two. It is recommended to rewrite the environment with new step API. logger.deprecation( /home/dawn_redwood/anaconda3/envs/ns-3.39.1/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:141: UserWarning: WARN: The obs returned by the step() method was expecting numpy array dtype to be uint64, actual type: int64 logger.warn( /home/dawn_redwood/anaconda3/envs/ns-3.39.1/lib/python3.9/site-packages/gym/utils/passive_env_checker.py:165: UserWarning: WARN: The obs returned by the step() method is not within the observation space. logger.warn(f"{pre} is not within the observation space.") Traceback (most recent call last): File "/home/dawn_redwood/ns-3-dev/contrib/opengym/examples/interference-pattern/./cognitive-agent-v1.py", line 209, in nextstate, reward, done, = env.step(action) File "/home/dawn_redwood/anaconda3/envs/ns-3.39.1/lib/python3.9/site-packages/gym/wrappers/order_enforcing.py", line 37, in step return self.env.step(action) File "/home/dawn_redwood/anaconda3/envs/ns-3.39.1/lib/python3.9/site-packages/gym/wrappers/env_checker.py", line 37, in step return env_step_passive_checker(self.env, action) File "/home/dawn_redwood/anaconda3/envs/ns-3.39.1/lib/python3.9/site-packages/gym/utils/passive_env_checker.py", line 261, in env_step_passive_checker assert isinstance( AssertionError: The info returned by step() must be a python dictionary, actual type: <class 'str'>

Linsooon commented 10 months ago

I encountered this error too. This errors is because of the new OpenAI Gym framework which is mentioned in Example section of README Hope this help :)