Getting started with local dev.
-
I just installed quantiacs for local devleopment using the instructions at https://github.com/quantiacs/toolbox?tab=readme-ov-file. I used pyenv not conda. I created a strategy.py by copying the example. When I run it I get an error as shown below. Any thoughts on what I am missing? I'm not experienced with python and im not sure how to troubleshoot this.
I am using ubuntu 22..04.3 under WSL on windows11.
During install I got a bunch of warnings like this
DEPRECATION: dash is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for dash ... done
I created a strategy.py file and ran it (as per the step 2 of the readme) and I get the following output
(qntdev) undrewb@LAPTOP-87ARNCG4:~/quantiacs$ python strategy.py NOTICE: The environment variable DATA_BASE_URL was not specified. The default value is 'https://data-api.quantiacs.io/' NOTICE: The environment variable CACHE_RETENTION was not specified. The default value is '7' NOTICE: The environment variable CACHE_DIR was not specified. The default value is 'data-cache' Run last pass... Load data... | | # | 9774919 Elapsed Time: 0:00:03 Run strategy... Load data for cleanup... Output cleaning... fix uniq Normalization... Output cleaning is complete. Write result... NOTICE: The environment variable OUTPUT_PATH was not specified. The default value is 'fractions.nc.gz' Write output: fractions.nc.gz --- Run first pass... Load data... | | # | 8941163 Elapsed Time: 0:00:03 Run strategy... --- Load full data... --- Run iterations... 100% (521 of 521) |##################################| Elapsed Time: 0:00:02 Time: 0:00:02 Merge outputs... Load data for cleanup and analysis... Output cleaning... fix uniq ffill if the current price is None... Check missed dates... Ok. Normalization... Output cleaning is complete. Write result... NOTICE: The environment variable OUTPUT_PATH was not specified. The default value is 'fractions.nc.gz' Write output: fractions.nc.gz --- Analyze results... Check... Check missed dates... Ok. Check the sharpe ratio... WARNING! There are not enough points in the data The first point(2021-03-15) should be earlier than 2006-01-01 Load data more historical data. WARNING! There are not enough points in the output. The output series should start from 2006-01-01 or earlier instead of 2022-05-13 Period: 2021-03-15 - 2024-05-10 Sharpe Ratio = -0.4106872125669945 ERROR! The Sharpe Ratio is too low. -0.4106872125669945 < 0.7 Improve the strategy and make sure that the in-sample Sharpe Ratio more than 0.7. --- Align... Calc global stats... --- Calc stats per asset... --- Build plots... ERROR:root:can't start dash Traceback (most recent call last): File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/qnt/backtester.py", line 520, in build_plots_dash import dash File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/dash/__init__.py", line 5, in <module> from .dash import Dash, no_update # noqa: F401,E402 File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/dash/dash.py", line 22, in <module> from werkzeug.debug.tbtools import get_current_traceback ImportError: cannot import name 'get_current_traceback' from 'werkzeug.debug.tbtools' (/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/werkzeug/debug/tbtools.py)
-
I downgraded werkzeug to 0.16.1 and now I get output around the error in dash
Build plots... ERROR:root:can't start dash Traceback (most recent call last): File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/qnt/backtester.py", line 520, in build_plots_dash import dash File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/dash/__init__.py", line 5, in <module> from .dash import Dash, no_update # noqa: F401,E402 File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/dash/dash.py", line 20, in <module> import flask File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/flask/__init__.py", line 5, in <module> from . import json as json File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/flask/json/__init__.py", line 6, in <module> from ..globals import current_app File "/home/undrewb/.pyenv/versions/qntdev/lib/python3.10/site-packages/flask/globals.py", line 25, in <module> app_ctx: AppContext = LocalProxy( # type: ignore[assignment] TypeError: LocalProxy.__init__() got an unexpected keyword argument 'unbound_mess
I still dont know what this means. Any thoughts?
-
It seems like theres a string of downgrades required to run this locally. Is this worth the hassle?
-
For the record, I got local dev working by doing the following downgrades. This seems like a lot - is there a better way to do this? Could this be something to add to the setup readme?
pip install werkzeug==0.16.1 pip install flask==1.1.2 pip install jinja2==2.11.3 pip install jupyter==1.0.0 pip install jinja2==2.11.3 pip install markupsafe==1.1.1 pip install itsdangerous==1.1.0
-
I am worried about how sustainable this solution is due to the warnings below. Is this going to be an issue for me in the future?
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. jupyter-server 2.14.0 requires jinja2>=3.0.3, but you have jinja2 2.11.3 which is incompatible. jupyterlab 4.1.8 requires jinja2>=3.0.3, but you have jinja2 2.11.3 which is incompatible. jupyterlab-server 2.27.1 requires jinja2>=3.0.3, but you have jinja2 2.11.3 which is incompatible. nbconvert 7.16.4 requires jinja2>=3.0, but you have jinja2 2.11.3 which is incompatible. nbconvert 7.16.4 requires markupsafe>=2.0, but you have markupsafe 1.1.1 which is incompatible.
-
@iron-tentacruel Sorry for the delay in the answer. We recommend conda as we can better track dependencies. With conda you can create locally an environment which mirrors the one on the Quantiacs server and you can work locally as you would on the server. If you need a specific version of a package, please let us know.