opendilab / DI-engine

OpenDILab Decision AI Engine. The Most Comprehensive Reinforcement Learning Framework B.P.
https://di-engine-docs.readthedocs.io
Apache License 2.0
2.82k stars 352 forks source link

Flask version error import #743

Closed juanmigutierrez closed 8 months ago

juanmigutierrez commented 8 months ago

I am running di-engine version 0.4.9. In linux I got the following error when importing flask

import gym # Load the gym library, which is used to standardize the reinforcement learning environment
import torch # Load the PyTorch library for loading the Tensor model and defining the computing network
from easydict import EasyDict # Load EasyDict for instantiating configuration files
from ding.config import compile_config # Load configuration related components in DI-engine config module
from ding.envs import DingEnvWrapper # Load environment related components in DI-engine env module
from ding.policy import DQNPolicy, single_env_forward_wrapper # Load policy-related components in DI-engine policy module
from ding.model import DQN # Load model related components in DI-engine model module
from dizoo.box2d.lunarlander.config.lunarlander_dqn_config import main_config, create_config # Load DI-zoo lunarlander environment and DQN algorithm related configurations
ImportError: cannot import name 'escape' from 'jinja2'

Nevertheless when trying to update flask to >2.2.2, it says the poetry

  Because di-engine (0.4.9) depends on flask (>=1.1.2,<1.2.0)
   and no versions of di-engine match >0.4.9,<0.5.0, di-engine (>=0.4.9,<0.5.0) requires flask (>=1.1.2,<1.2.0).
  So, because app depends on both di-engine (^0.4.9) and flask (2.2.2), version solving failed.

How solve this dependency error ?

juanmigutierrez commented 8 months ago

Also colab example does not work sadly. I think there is a problem of versioning

PaParaZz1 commented 8 months ago

You can try to install flask==1.1.2 and jinja2==3.0.3.

I also test the colab demo (cartpole + DQN) and find there is no version problem.

juanmigutierrez commented 8 months ago

Yes I had to installed it manually poetry add flask==1.1.2 and poetry add jinja2==3.0.3, Seems its working now thanks.