FinRL icon indicating copy to clipboard operation
FinRL copied to clipboard

Problem with Imports

Open usamahassan965 opened this issue 1 year ago • 10 comments

I have used this code below for pre-installatiions of packages on colab . It was working fine. But from yesterday it throws me an error when installing finrl.

!pip install swig !pip install box2d-py !pip install box2d !pip install Box2D !pip install git+https://github.com/AI4Finance-Foundation/FinRL.git

Collecting git+https://github.com/AI4Finance-Foundation/FinRL.git Cloning https://github.com/AI4Finance-Foundation/FinRL.git to /tmp/pip-req-build-l61mbivj Running command git clone --filter=blob:none --quiet https://github.com/AI4Finance-Foundation/FinRL.git /tmp/pip-req-build-l61mbivj Resolved https://github.com/AI4Finance-Foundation/FinRL.git to commit b781b80727bb8848e7addcfd6fa61e1ff6b06fa3 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting elegantrl@ git+https://github.com/AI4Finance-Foundation/ElegantRL.git#egg=elegantrl (from finrl==0.3.6) Cloning https://github.com/AI4Finance-Foundation/ElegantRL.git to /tmp/pip-install-sk7wp95x/elegantrl_acf3f1aa56464c9eb59dd44529787098 Running command git clone --filter=blob:none --quiet https://github.com/AI4Finance-Foundation/ElegantRL.git /tmp/pip-install-sk7wp95x/elegantrl_acf3f1aa56464c9eb59dd44529787098 Resolved https://github.com/AI4Finance-Foundation/ElegantRL.git to commit 4c1893aeeb350e952bdcce916b13e6650a84cd68 Preparing metadata (setup.py) ... done Collecting alpaca-trade-api<4,>=3 (from finrl==0.3.6) Obtaining dependency information for alpaca-trade-api<4,>=3 from https://files.pythonhosted.org/packages/84/5e/4912930d8f64a4a8c425b2a277849cc339a22b2046d3ecd7cbe6743f0021/alpaca_trade_api-3.0.2-py3-none-any.whl.metadata Using cached alpaca_trade_api-3.0.2-py3-none-any.whl.metadata (29 kB) Collecting ccxt<4,>=3 (from finrl==0.3.6) Obtaining dependency information for ccxt<4,>=3 from https://files.pythonhosted.org/packages/c6/c3/5082649cf584dae9ee18d7d90895475e8f382b52e9c8588320f477639e04/ccxt-3.1.60-py2.py3-none-any.whl.metadata Using cached ccxt-3.1.60-py2.py3-none-any.whl.metadata (108 kB) Collecting exchange-calendars<5,>=4 (from finrl==0.3.6) Obtaining dependency information for exchange-calendars<5,>=4 from https://files.pythonhosted.org/packages/79/a8/d7e75932a97e253dd300bb94533af230788f71443353c48c85032f256870/exchange_calendars-4.5-py3-none-any.whl.metadata Using cached exchange_calendars-4.5-py3-none-any.whl.metadata (37 kB) Collecting jqdatasdk<2,>=1 (from finrl==0.3.6) Obtaining dependency information for jqdatasdk<2,>=1 from https://files.pythonhosted.org/packages/63/6b/4bc2747558a03d006f4bdafc3413325fb59fb1dc1427ab54b3e3272fa1c1/jqdatasdk-1.9.0-py3-none-any.whl.metadata Using cached jqdatasdk-1.9.0-py3-none-any.whl.metadata (5.7 kB) Collecting pyfolio<0.10,>=0.9 (from finrl==0.3.6) Using cached pyfolio-0.9.2.tar.gz (91 kB) Preparing metadata (setup.py) ... done Collecting pyportfolioopt<2,>=1 (from finrl==0.3.6) Using cached pyportfolioopt-1.5.5-py3-none-any.whl (61 kB) Collecting ray[default,tune]<3,>=2 (from finrl==0.3.6) Obtaining dependency information for ray[default,tune]<3,>=2 from https://files.pythonhosted.org/packages/d5/d1/50c97d98a8ead5660b832136b7cfcab0b4ed02099bf0fa6e7b18beaf3ba8/ray-2.6.3-cp310-cp310-manylinux2014_x86_64.whl.metadata Using cached ray-2.6.3-cp310-cp310-manylinux2014_x86_64.whl.metadata (12 kB) Requirement already satisfied: scikit-learn<2,>=1 in /usr/local/lib/python3.10/dist-packages (from finrl==0.3.6) (1.2.2) Collecting stable-baselines3[extra]>=2.0.0a5 (from finrl==0.3.6) Obtaining dependency information for stable-baselines3[extra]>=2.0.0a5 from https://files.pythonhosted.org/packages/5e/81/7a0fbfc45240ec36cc3fcfe8f135996ef03277e2305d941a6d9186eb14e8/stable_baselines3-2.1.0-py3-none-any.whl.metadata Using cached stable_baselines3-2.1.0-py3-none-any.whl.metadata (5.2 kB) Collecting stockstats<0.6,>=0.5 (from finrl==0.3.6) Obtaining dependency information for stockstats<0.6,>=0.5 from https://files.pythonhosted.org/packages/89/c3/82708cf1d219d762d6bb1a05428d918ad3f68c26b7f6e10a7449942a12c8/stockstats-0.5.4-py2.py3-none-any.whl.metadata Using cached stockstats-0.5.4-py2.py3-none-any.whl.metadata (26 kB) Collecting wrds<4,>=3 (from finrl==0.3.6) Using cached wrds-3.1.6-py3-none-any.whl (12 kB) Requirement already satisfied: yfinance<0.3,>=0.2 in /usr/local/lib/python3.10/dist-packages (from finrl==0.3.6) (0.2.28) Requirement already satisfied: pandas>=0.18.1 in /usr/local/lib/python3.10/dist-packages (from alpaca-trade-api<4,>=3->finrl==0.3.6) (1.5.3) Requirement already satisfied: numpy>=1.11.1 in /usr/local/lib/python3.10/dist-packages (from alpaca-trade-api<4,>=3->finrl==0.3.6) (1.23.5) Requirement already satisfied: requests<3,>2 in /usr/local/lib/python3.10/dist-packages (from alpaca-trade-api<4,>=3->finrl==0.3.6) (2.31.0) Collecting urllib3<2,>1.24 (from alpaca-trade-api<4,>=3->finrl==0.3.6) Obtaining dependency information for urllib3<2,>1.24 from https://files.pythonhosted.org/packages/c5/05/c214b32d21c0b465506f95c4f28ccbcba15022e000b043b72b3df7728471/urllib3-1.26.16-py2.py3-none-any.whl.metadata Using cached urllib3-1.26.16-py2.py3-none-any.whl.metadata (48 kB) Requirement already satisfied: websocket-client<2,>=0.56.0 in /usr/local/lib/python3.10/dist-packages (from alpaca-trade-api<4,>=3->finrl==0.3.6) (1.6.2) Collecting websockets<11,>=9.0 (from alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached websockets-10.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (106 kB) Collecting msgpack==1.0.3 (from alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached msgpack-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323 kB) Collecting aiohttp==3.8.2 (from alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached aiohttp-3.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB) Collecting PyYAML==6.0 (from alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (682 kB) Collecting deprecation==2.1.0 (from alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached deprecation-2.1.0-py2.py3-none-any.whl (11 kB) Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) (23.1.0) Collecting charset-normalizer<3.0,>=2.0 (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB) Collecting multidict<6.0,>=4.5 (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) Using cached multidict-5.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (175 kB) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/dist-packages (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) (4.0.3) Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) (1.9.2) Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) (1.4.0) Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp==3.8.2->alpaca-trade-api<4,>=3->finrl==0.3.6) (1.3.1) Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from deprecation==2.1.0->alpaca-trade-api<4,>=3->finrl==0.3.6) (23.1) Requirement already satisfied: setuptools>=60.9.0 in /usr/local/lib/python3.10/dist-packages (from ccxt<4,>=3->finrl==0.3.6) (68.2.1) Requirement already satisfied: certifi>=2018.1.18 in /usr/local/lib/python3.10/dist-packages (from ccxt<4,>=3->finrl==0.3.6) (2023.7.22) Requirement already satisfied: cryptography>=2.6.1 in /usr/local/lib/python3.10/dist-packages (from ccxt<4,>=3->finrl==0.3.6) (41.0.3) Collecting aiodns>=1.1.1 (from ccxt<4,>=3->finrl==0.3.6) Using cached aiodns-3.0.0-py3-none-any.whl (5.0 kB) Collecting pyluach (from exchange-calendars<5,>=4->finrl==0.3.6) Using cached pyluach-2.2.0-py3-none-any.whl (25 kB) Requirement already satisfied: python-dateutil in /usr/local/lib/python3.10/dist-packages (from exchange-calendars<5,>=4->finrl==0.3.6) (2.8.2) Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from exchange-calendars<5,>=4->finrl==0.3.6) (0.12.0) Collecting tzdata (from exchange-calendars<5,>=4->finrl==0.3.6) Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB) Collecting korean-lunar-calendar (from exchange-calendars<5,>=4->finrl==0.3.6) Using cached korean_lunar_calendar-0.3.1-py3-none-any.whl (9.0 kB) Requirement already satisfied: six in /usr/local/lib/python3.10/dist-packages (from jqdatasdk<2,>=1->finrl==0.3.6) (1.16.0) Requirement already satisfied: SQLAlchemy>=1.2.8 in /usr/local/lib/python3.10/dist-packages (from jqdatasdk<2,>=1->finrl==0.3.6) (2.0.20) Collecting thriftpy2>=0.3.9 (from jqdatasdk<2,>=1->finrl==0.3.6) Using cached thriftpy2-0.4.16.tar.gz (643 kB) error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. Preparing metadata (setup.py) ... error error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

usamahassan965 avatar Sep 12 '23 05:09 usamahassan965

Can confirm I have the same issue. Please help/advice how we can continue to use your fantastic finrl package!

matt-rose-spectrum avatar Sep 12 '23 13:09 matt-rose-spectrum

I am also waiting for support

usamahassan965 avatar Sep 12 '23 13:09 usamahassan965

When installing the FinRL package in Google Colab, there appears to be an issue with the thriftpy2 library. The installation requirements call for thriftpy2, but attempting to install it results in an error. When you try to in stall only the thriftpy2, the same error is raised:

image

This error seems to be only in colab, when I try to install it locally, it works correctly:

image

Although thriftpy2 is not created in the FinRL project itself, this library source code can be found at https://github.com/Thriftpy/thriftpy2. If you are using colab, it is suggested that you switch your project locally while waiting for the issue to be resolved.

mmmarchetti avatar Sep 12 '23 22:09 mmmarchetti

But locally, finrl downgrades to 0.3.4 version due to other dependencies version issues.

usamahassan965 avatar Sep 13 '23 05:09 usamahassan965

When you use !pip install git+https://github.com/AI4Finance-Foundation/FinRL.git the FinRL version is supposed to be the same in any platform. Additionally, for this error with the thriftpy2 library is in Google Colab, we can only wait until the teams of Colab and thriftpy2 solve this issue, because this library is not maintained by the FinRL team.

mmmarchetti avatar Sep 13 '23 11:09 mmmarchetti

Please fix FinRL team!

matt-rose-spectrum avatar Sep 13 '23 14:09 matt-rose-spectrum

Please fix FinRL team!

As I mentioned earlier, this issue does not involve the FinRL team, but the Google Colab and thriftpy2 team.

mmmarchetti avatar Sep 13 '23 15:09 mmmarchetti

Thank you for being a lot smarter than me! But yes, none the less I hope they fix ASAFP

matt-rose-spectrum avatar Sep 13 '23 15:09 matt-rose-spectrum

@usamahassan965 @matt-rose-spectrum You can try installing the library following the below snippet, I found it at one of FinRL tutorials.

!pip install wrds !pip install swig !pip install -q condacolab import condacolab condacolab.install() !apt-get update -y -qq && apt-get install -y -qq cmake libopenmpi-dev python3-dev zlib1g-dev libgl1-mesa-glx swig !pip install git+https://github.com/AI4Finance-Foundation/FinRL.git

after running the above imports the runtime will restart after which run the below and it should work.

!pip install -U ipython

oamerl avatar Sep 22 '23 20:09 oamerl

I have same problem

jezzrezz avatar Sep 26 '23 18:09 jezzrezz