AI4Finance-Foundation / FinRL-Trading

For trading. Please star.
https://ai4finance.org
MIT License
1.97k stars 717 forks source link

SyntaxError #32

Open nospam999 opened 3 years ago

nospam999 commented 3 years ago

Hello, I cannot run the code because I get this error:

(venv) linus@linux:~/trading/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020$ python run_DRL.py
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

Traceback (most recent call last):
  File "run_DRL.py", line 12, in <module>
    from model.models import *
  File "/home/linus/trading/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020/model/models.py", line 23, in <module>
    from env.EnvMultipleStock_train import StockEnvTrain
  File "/home/linus/trading/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020/venv/lib/python3.6/site-packages/env.py", line 51
    print k
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(k)?

> `
nospam999 commented 3 years ago

okay, I think the problem was there were no brackets at the print-statetement (how could this script ran at your computer?) now another problem (this script is so horrible):

> myvenv) linus@linux:~/trading/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020$ python run_DRL.py
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

Traceback (most recent call last):
  File "run_DRL.py", line 12, in <module>
    from model.models import *
  File "/home/linus/trading/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020/model/models.py", line 24, in <module>
    from env.EnvMultipleStock_validation import StockEnvValidation
  File "/home/linus/trading/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020/myvenv/lib/python3.6/site-packages/env.py", line 4, in <module>
    from urlparse import urlparse as _urlparse
ModuleNotFoundError: No module named 'urlparse'
`` 
IvanTrujilloTrujillo commented 11 months ago

You installed python package 'env' and in models.py it is importing this package, but this isn't what the package you need. You have to uninstall 'env' and create three files im a folder/module called 'env'. The have it in the repo but they deleted it in this commit: Hi! I found they deleted them when refactoring and never solve it. Here is the commit when this happened, you can take the files from there: https://github.com/AI4Finance-Foundation/FinRL-Trading/commit/20b589847e85e8f73ed5ecb43d74b8eb10c84fbd and never solve it. You can restore it the files from this commit.