Search code examples
anacondareinforcement-learningopenai-gym

ModuleNotFoundError: No module named 'gym_anytrading'


Windows 10 operating system, Anaconda used.

import sys
!conda install --yes --prefix {sys.prefix}  -c anaconda gymnasium

was successfully completed as well as

import sys
!pip3 install gym-anytrading

When importing

import gymnasium as gym
import gym_anytrading

I get this error

----> 1 import gym_anytrading

ModuleNotFoundError: No module named 'gym_anytrading'

Any idea?


Solution

  • I discovered that somehow installing with pip3 instead anaconda for which I have not found gym-anytrading from Jupyter Notebook, the package was installed in a different and wrong directory with respect to the conda environment in use at that moment and by that Notebook. I have then installed it by pip3 from the command line once inside the folder used by the selected conda environment.

    Regretfully, I have then discovered that gym-anytrading appears to be not compatible with TF-Agents because it seems missing some properties and methods of the Gym/Gymnasium environment standards. So I have opened another question here Compatibility of anytrading Gym environment with TF-Agents and directly in the github public repository issues tracking https://github.com/AminHP/gym-anytrading/issues/88 for which I ask a kind help to the community hoping it will be useful for others too.

    Give anyway a read to @Wayne remearks above, they are very useful for installing packages from inside a Jupyter environment.