tamuseanmiller / alpaca-stock-trading-bot

📈 Q-Learning and Sentiment Analysis Stock Trade Bot Powered by Alpaca
GNU General Public License v3.0
42 stars 13 forks source link

Unsupported dependency version #23

Closed Hudson31 closed 2 years ago

Hudson31 commented 2 years ago

Wanted to just see if anyone else has had this issue and a fix for it. Currently trying to adapt this repository to be up to date with the current Alpaca API. Once installing all the dependencies at the listed versions on the requirements.txt it seems to not be the correct version but it will not tell me what is compatible. Something I already tried is using pip to get the most recent version but it tells me the requirement is already satisfied. Any help from anyone who has faced the issue or has a solution would be greatly appreciated! For reference, this is a setup with all the default files and required dependencies so it makes sense since this project is a little dated. The code output after running the example train.py is:

/home/hudson/.local/lib/python3.8/site-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (1.26.5) or chardet (3.0.4) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported " 2022-02-15 18:28:16.665811: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory 2022-02-15 18:28:16.665856: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd Traceback (most recent call last): File "train.py", line 28, in from trading_bot.agent import Agent File "/home/hudson/alpaca-stock-trading-bot/trading_bot/agent.py", line 7, in import tensorflow as tf File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/init.py", line 37, in from tensorflow.python.tools import module_util as _module_util File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/python/init.py", line 37, in from tensorflow.python.eager import context File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 35, in from tensorflow.python.client import pywrap_tf_session File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/python/client/pywrap_tf_session.py", line 19, in from tensorflow.python.client._pywrap_tf_session import * ImportError: SystemError: <built-in method contains of dict object at 0x7f9c9a902840> returned a result with an error set

tamuseanmiller commented 2 years ago

I just googled this so let me know if this works, but you can try updating requests.

pip3 install --upgrade requests or pip3 install --upgrade requests==2.20.1

Hudson31 commented 2 years ago

Thanks for the response! I just did that and I got the same error. When installing that though I did notice it finally told me some dependency conflicts which were:

"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorboard 2.2.2 requires requests<3,>=2.21.0, but you have requests 2.20.1 which is incompatible. konoha 4.6.5 requires requests<3.0.0,>=2.25.1, but you have requests 2.20.1 which is incompatible. alpaca-trade-api 0.49.0 requires websockets<9,>=8.0, but you have websockets 9.1 which is incompatible."

I proceeded to correct these by installing the correct versions. Unfortunately, after doing this it still gives me the same error I pasted above.

Hudson31 commented 2 years ago

Actually, I must note the error is slightly different, it seems the dependency errors were resolved but the other errors lower down seem to still be happening. Can't find anything online that really leads me in the right direction. The new output when trying to train is:

2022-02-15 23:28:54.222075: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory 2022-02-15 23:28:54.222114: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd Traceback (most recent call last): File "train.py", line 28, in from trading_bot.agent import Agent File "/home/hudson/alpaca-stock-trading-bot/trading_bot/agent.py", line 7, in import tensorflow as tf File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/init.py", line 37, in from tensorflow.python.tools import module_util as _module_util File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/python/init.py", line 37, in from tensorflow.python.eager import context File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 35, in from tensorflow.python.client import pywrap_tf_session File "/home/hudson/.local/lib/python3.8/site-packages/tensorflow/python/client/pywrap_tf_session.py", line 19, in from tensorflow.python.client._pywrap_tf_session import * ImportError: SystemError: <built-in method contains of dict object at 0x7f95e4d60c80> returned a result with an error set

Hudson31 commented 2 years ago

Hi,

Just to update you on my progress. I have managed to solve all dependency and other errors when running train.py. Now whenever I try to run your example code it just tells me how to use it. For example this is the output:

python3 train.py 12 --window-size=10 --episode-count=10 --model-name=model_alpha --stock_name=AMD 2022-02-17 04:37:19.836369: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory 2022-02-17 04:37:19.836412: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. Usage: train.py [--window-size=] [--batch-size=] [--episode-count=] [--model-name=] [--pretrained] [--debug] [--stock-name=]

I tried rearranging it in the order it is listed in and it just tells me the same thing. Any ideas on how to fix this part? Thanks!

Hudson31 commented 2 years ago

Boom! I got it! Sorry for the message spam, I did it by just manually filling the information in it requested. Now unfortunately my problem is the Polygon data which I am going to have to figure out. Rather expensive subscription at $200 a month for live data.