ModuleNotFoundError using Jupyter

Viewed 29

I am following a tutorial for Jupyter but I´m getting some errors. The code is in https://github.com/nicknochnack/Reinforcement-Learning-for-Trading-Custom-Signals/blob/main/Custom%20Signals.ipynb

At some point it says:

from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines import A2C

I get this error:

Input In [85], in <cell line: 7>()
      5 # Stable baselines - rl stuff
      6 from stable_baselines.common.vec_env import DummyVecEnv
----> 7 from stable_baselines import A2C

I read that stable_baselines was not used and that the current one is stable_baselines3. So I installed and changed the code to

from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3 import A2C

but then it says:

ValueError                                Traceback (most recent call last)
Input In [84], in <cell line: 1>()
----> 1 model = A2C('MlpLstmPolicy', env, verbose=1) 
      2 model.learn(total_timesteps=1000000)

File /Applications/Anaconda/anaconda3/lib/python3.9/site-packages/stable_baselines3/a2c/a2c.py:85, in A2C.__init__(self, policy, env, learning_rate, n_steps, gamma, gae_lambda, ent_coef, vf_coef, max_grad_norm, rms_prop_eps, use_rms_prop, use_sde, sde_sample_freq, normalize_advantage, tensorboard_log, create_eval_env, policy_kwargs, verbose, seed, device, _init_setup_model)
     60 def __init__(
     61     self,
     62     policy: Union[str, Type[ActorCriticPolicy]],
   (...)
     82     _init_setup_model: bool = True,
     83 ):
---> 85     super().__init__(
1 Answers

There is no support for LSTM/RNN policies in stable_baselines3, yet. You need to use stable_baselines. If you can change your question in a way, that we can see what the error was while importing stable_baselines, maybe we can get it to work.

Related