ns19
ns19

Reputation: 23

Program runs in Jupyter Notebook but not in VS code

I can run this script (https://github.com/carlosnatalino/optical-rl-gym/blob/master/examples/stable_baselines/DeepRMSA.ipynb) fine on Jupyter Notebook; however, when I try to run it on VS code I get the following error:

File "c:\Users\N1\optical-rl-gym\examples\stable_baselines\test.py", line 91, in <module>
    agent.learn(total_timesteps=100000, callback=callback)

  File "D:\Programs\Anaconda\envs\tf\lib\site-packages\stable_baselines\ppo2\ppo2.py", line 336, in learn
    rollout = self.runner.run(callback)

  File "D:\Programs\Anaconda\envs\tf\lib\site-packages\stable_baselines\common\runners.py", line 48, in run
    return self._run()

  File "D:\Programs\Anaconda\envs\tf\lib\site-packages\stable_baselines\ppo2\ppo2.py", line 488, in _run
    if self.callback.on_step() is False:
  File "D:\Programs\Anaconda\envs\tf\lib\site-packages\stable_baselines\common\callbacks.py", line 89, in on_step
    return self._on_step()

  File "c:\Users\N1\optical-rl-gym\examples\stable_baselines\test.py", line 61, in _on_step
    clear_output(wait=True)
NameError: name 'clear_output' is not defined

What is causing this error? I am running both Jupyter Notebook and VS code in the same environment

Upvotes: 0

Views: 743

Answers (1)

pawmasz
pawmasz

Reputation: 103

Are you sure you have clear_output from this line:

from IPython.display import clear_output

installed and imported correctly in VS Code? Try to run just this part.

Upvotes: 1

Related Questions