AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.65k stars 2.34k forks source link

ImportError: cannot import name 'QUAL_PALETTES' #231

Closed forrestneo closed 2 years ago

forrestneo commented 3 years ago

ImportError Traceback (most recent call last)

in () 14 from finrl.env.env_stocktrading import StockTradingEnv 15 from finrl.model.models import DRLAgent ---> 16 from finrl.trade.backtest import backtest_stats, backtest_plot, get_daily_return, get_baseline 17 from stable_baselines3 import DDPG 18 from stable_baselines3 import A2C ~/FinRL-Library/finrl/trade/backtest.py in () 2 import numpy as np 3 ----> 4 from pyfolio import timeseries 5 import pyfolio 6 import matplotlib.pyplot as plt /opt/conda/lib/python3.6/site-packages/pyfolio/__init__.py in () 11 from . import perf_attrib 12 ---> 13 from .tears import * # noqa 14 from .plotting import * # noqa 15 from ._version import get_versions /opt/conda/lib/python3.6/site-packages/pyfolio/tears.py in () 26 import scipy.stats 27 ---> 28 from . import _seaborn as sns 29 from . import capacity 30 from . import perf_attrib /opt/conda/lib/python3.6/site-packages/pyfolio/_seaborn.py in () 16 'matplotlib', 17 ) ---> 18 from seaborn import * # noqa /opt/conda/lib/python3.6/site-packages/seaborn/__init__.py in () 3 from .utils import * # noqa: F401,F403 4 from .palettes import * # noqa: F401,F403 ----> 5 from .relational import * # noqa: F401,F403 6 from .regression import * # noqa: F401,F403 7 from .categorical import * # noqa: F401,F403 /opt/conda/lib/python3.6/site-packages/seaborn/relational.py in () 6 import matplotlib.pyplot as plt 7 ----> 8 from ._core import ( 9 VectorPlotter, 10 ) /opt/conda/lib/python3.6/site-packages/seaborn/_core.py in () 15 share_init_params_with_map, 16 ) ---> 17 from .palettes import ( 18 QUAL_PALETTES, 19 color_palette, ImportError: cannot import name 'QUAL_PALETTES'
rayrui312 commented 3 years ago

Thanks for reporting errors.

I think this error doesn't come from FinRL. QUAL_PALETTES is a module inside seaborn. This error could occur due to your unsuccessful installation of the seaborn. It is hard to tell the specific reason. However, I think you can try the following steps and see if the issue can be solved:

  1. Remove the existing package of seaborn and reinstall it.
  2. If 1 doesn't work, create a new virtual environment and reinstall FinRL to use it. (2 is stupid, but it should work.)

By the way, I think you can try to attach codes instead of using texts to report errors. Texts are hard to read.

Hope this helps.