robertmartin8 / PyPortfolioOpt

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
https://pyportfolioopt.readthedocs.io/
MIT License
4.26k stars 929 forks source link

Docker build failed due to dir name and Dockerfile mismatch #476

Closed yosukesan closed 1 year ago

yosukesan commented 1 year ago

I feel this is just a minor bug. Sorry if it is not.

Describe the bug Docker build failed due to dir name mismatch. In project root dir, cookbook need to be cookbooks or docker file "RUN cd cookbook" need to be fixed. I feel renaming dir is logical since dir has some books.

I locally renamed the dir and it docker build terminated normally.

Expected behavior docker build terminates normally

Code sample docker build -f docker/Dockerfile . in project root dir Probably better to add simple installation test. Like the command above.

Operating system, python version, PyPortfolioOpt version

Additional context Err Log

$ docker build -f  docker/Dockerfile  .
Sending build context to Docker daemon  18.14MB
Step 1/6 : FROM python:3.8-buster
 ---> 1c8fafb52ada
Step 2/6 : WORKDIR pypfopt
 ---> Using cache
 ---> 1ed3a970246f
Step 3/6 : COPY pyproject.toml poetry.lock ./
 ---> 319e914bdf4d
Step 4/6 : RUN pip install --upgrade pip==21.0.1 &&     pip install "poetry==1.1.4" &&     pip install yfinance &&     poetry install -E optionals --no-root
 ---> Running in 4ca614687435
Collecting pip==21.0.1
  Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 4.5 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.0.4
    Uninstalling pip-22.0.4:
      Successfully uninstalled pip-22.0.4
Successfully installed pip-21.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Collecting poetry==1.1.4
  Downloading poetry-1.1.4-py2.py3-none-any.whl (171 kB)
Collecting shellingham<2.0,>=1.1
  Downloading shellingham-1.5.0-py2.py3-none-any.whl (9.3 kB)
Collecting poetry-core<2.0.0,>=1.0.0
  Downloading poetry_core-1.0.8-py2.py3-none-any.whl (425 kB)
Collecting requests<3.0,>=2.18
  Downloading requests-2.28.1-py3-none-any.whl (62 kB)
Collecting cachy<0.4.0,>=0.3.0
  Downloading cachy-0.3.0-py2.py3-none-any.whl (20 kB)
Collecting clikit<0.7.0,>=0.6.2
  Downloading clikit-0.6.2-py2.py3-none-any.whl (91 kB)
Collecting requests-toolbelt<0.10.0,>=0.9.1
  Downloading requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB)
Collecting tomlkit<1.0.0,>=0.7.0
  Downloading tomlkit-0.11.4-py3-none-any.whl (35 kB)
Collecting pexpect<5.0.0,>=4.7.0
  Downloading pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
Collecting html5lib<2.0,>=1.0
  Downloading html5lib-1.1-py2.py3-none-any.whl (112 kB)
Collecting keyring<22.0.0,>=21.2.0
  Downloading keyring-21.8.0-py3-none-any.whl (32 kB)
Collecting packaging<21.0,>=20.4
  Downloading packaging-20.9-py2.py3-none-any.whl (40 kB)
Collecting cleo<0.9.0,>=0.8.1
  Downloading cleo-0.8.1-py2.py3-none-any.whl (21 kB)
Collecting cachecontrol[filecache]<0.13.0,>=0.12.4
  Downloading CacheControl-0.12.11-py2.py3-none-any.whl (21 kB)
Collecting virtualenv<21.0.0,>=20.0.26
  Downloading virtualenv-20.16.3-py2.py3-none-any.whl (8.8 MB)
Collecting pkginfo<2.0,>=1.4
  Downloading pkginfo-1.8.3-py2.py3-none-any.whl (26 kB)
Collecting crashtest<0.4.0,>=0.3.0
  Downloading crashtest-0.3.1-py3-none-any.whl (7.0 kB)
Collecting msgpack>=0.5.2
  Downloading msgpack-1.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (322 kB)
Collecting lockfile>=0.9
  Downloading lockfile-0.12.2-py2.py3-none-any.whl (13 kB)
Collecting pastel<0.3.0,>=0.2.0
  Downloading pastel-0.2.1-py2.py3-none-any.whl (6.0 kB)
Collecting pylev<2.0,>=1.3
  Downloading pylev-1.4.0-py2.py3-none-any.whl (6.1 kB)
Collecting six>=1.9
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting webencodings
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting jeepney>=0.4.2
  Downloading jeepney-0.8.0-py3-none-any.whl (48 kB)
Collecting SecretStorage>=3.2
  Downloading SecretStorage-3.3.3-py3-none-any.whl (15 kB)
Collecting pyparsing>=2.0.2
  Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting ptyprocess>=0.5
  Downloading ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2022.6.15-py3-none-any.whl (160 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting charset-normalizer<3,>=2
  Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting cryptography>=2.0
  Downloading cryptography-37.0.4-cp36-abi3-manylinux_2_24_x86_64.whl (4.1 MB)
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (442 kB)
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting distlib<1,>=0.3.5
  Downloading distlib-0.3.5-py2.py3-none-any.whl (466 kB)
Collecting filelock<4,>=3.4.1
  Downloading filelock-3.8.0-py3-none-any.whl (10 kB)
Collecting platformdirs<3,>=2.4
  Downloading platformdirs-2.5.2-py3-none-any.whl (14 kB)
Installing collected packages: pycparser, urllib3, idna, charset-normalizer, cffi, certifi, requests, pylev, pastel, msgpack, jeepney, cryptography, crashtest, webencodings, six, SecretStorage, pyparsing, ptyprocess, platformdirs, lockfile, filelock, distlib, clikit, cachecontrol, virtualenv, tomlkit, shellingham, requests-toolbelt, poetry-core, pkginfo, pexpect, packaging, keyring, html5lib, cleo, cachy, poetry
Successfully installed SecretStorage-3.3.3 cachecontrol-0.12.11 cachy-0.3.0 certifi-2022.6.15 cffi-1.15.1 charset-normalizer-2.1.1 cleo-0.8.1 clikit-0.6.2 crashtest-0.3.1 cryptography-37.0.4 distlib-0.3.5 filelock-3.8.0 html5lib-1.1 idna-3.3 jeepney-0.8.0 keyring-21.8.0 lockfile-0.12.2 msgpack-1.0.4 packaging-20.9 pastel-0.2.1 pexpect-4.8.0 pkginfo-1.8.3 platformdirs-2.5.2 poetry-1.1.4 poetry-core-1.0.8 ptyprocess-0.7.0 pycparser-2.21 pylev-1.4.0 pyparsing-3.0.9 requests-2.28.1 requests-toolbelt-0.9.1 shellingham-1.5.0 six-1.16.0 tomlkit-0.11.4 urllib3-1.26.12 virtualenv-20.16.3 webencodings-0.5.1
WARNING: You are using pip version 21.0.1; however, version 22.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Collecting yfinance
  Downloading yfinance-0.1.74-py2.py3-none-any.whl (27 kB)
Collecting numpy>=1.15
  Downloading numpy-1.23.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
Collecting lxml>=4.5.1
  Downloading lxml-4.9.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (6.9 MB)
Collecting pandas>=0.24.0
  Downloading pandas-1.4.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Collecting multitasking>=0.0.7
  Downloading multitasking-0.0.11-py3-none-any.whl (8.5 kB)
Requirement already satisfied: requests>=2.26 in /usr/local/lib/python3.8/site-packages (from yfinance) (2.28.1)
Collecting pytz>=2020.1
  Downloading pytz-2022.2.1-py2.py3-none-any.whl (500 kB)
Collecting python-dateutil>=2.8.1
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/site-packages (from python-dateutil>=2.8.1->pandas>=0.24.0->yfinance) (1.16.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests>=2.26->yfinance) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests>=2.26->yfinance) (2022.6.15)
Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.8/site-packages (from requests>=2.26->yfinance) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.8/site-packages (from requests>=2.26->yfinance) (3.3)
Installing collected packages: pytz, python-dateutil, numpy, pandas, multitasking, lxml, yfinance
Successfully installed lxml-4.9.1 multitasking-0.0.11 numpy-1.23.2 pandas-1.4.3 python-dateutil-2.8.2 pytz-2022.2.1 yfinance-0.1.74
WARNING: You are using pip version 21.0.1; however, version 22.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Creating virtualenv pyportfolioopt-SZ_KFjxI-py3.8 in /root/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 113 installs, 0 updates, 0 removals

  • Installing zipp (3.8.0)
  • Installing attrs (21.4.0)
  • Installing importlib-resources (5.7.1)
  • Installing pyrsistent (0.18.1)
  • Installing traitlets (5.2.1.post0)
  • Installing six (1.16.0)
  • Installing entrypoints (0.4)
  • Installing fastjsonschema (2.15.3)
  • Installing jsonschema (4.5.1)
  • Installing nest-asyncio (1.5.5)
  • Installing pycparser (2.21)
  • Installing jupyter-core (4.10.0)
  • Installing python-dateutil (2.8.2)
  • Installing pyzmq (23.0.0)
  • Installing tornado (6.1)
  • Installing asttokens (2.0.5)
  • Installing cffi (1.15.0)
  • Installing jupyter-client (7.3.1)
  • Installing nbformat (5.4.0)
  • Installing executing (0.8.3)
  • Installing parso (0.8.3)
  • Installing markupsafe (2.1.1)
  • Installing ptyprocess (0.7.0)
  • Installing pure-eval (0.2.2)
  • Installing pyparsing (3.0.9)
  • Installing soupsieve (2.3.2.post1)
  • Installing wcwidth (0.2.5)
  • Installing webencodings (0.5.1)
  • Installing argon2-cffi-bindings (21.2.0)
  • Installing backcall (0.2.0)
  • Installing beautifulsoup4 (4.11.1)
  • Installing bleach (5.0.0)
  • Installing decorator (5.1.1)
  • Installing defusedxml (0.7.1)
  • Installing jedi (0.18.1)
  • Installing idna (3.3)
  • Installing jinja2 (3.1.2)
  • Installing jupyterlab-pygments (0.2.2)
  • Installing matplotlib-inline (0.1.3)
  • Installing mistune (0.8.4)
  • Installing nbclient (0.6.3)
  • Installing packaging (21.3)
  • Installing pandocfilters (1.5.0)
  • Installing pexpect (4.8.0)
  • Installing pickleshare (0.7.5)
  • Installing prompt-toolkit (3.0.29)
  • Installing pygments (2.12.0)
  • Installing sniffio (1.2.0)
  • Installing stack-data (0.2.0)
  • Installing tinycss2 (1.1.1)
  • Installing anyio (3.6.1)
  • Installing argon2-cffi (21.3.0)
  • Installing debugpy (1.6.0)
  • Installing ipython (8.3.0)
  • Installing nbconvert (6.5.0)
  • Installing numpy (1.22.4)
  • Installing psutil (5.9.1)
  • Installing prometheus-client (0.14.1)
  • Installing send2trash (1.8.0)
  • Installing terminado (0.15.0)
  • Installing websocket-client (1.3.2)
  • Installing certifi (2022.5.18.1)
  • Installing charset-normalizer (2.0.12)
  • Installing ipykernel (6.13.0)
  • Installing ipython-genutils (0.2.0)
  • Installing jupyter-server (1.17.0)
  • Installing scipy (1.8.1)
  • Installing urllib3 (1.26.9)
  • Installing pytz (2022.1)
  • Installing babel (2.10.1)
  • Installing importlib-metadata (4.11.4)
  • Installing iniconfig (1.1.1)
  • Installing json5 (0.9.8)
  • Installing notebook (6.4.11)
  • Installing notebook-shim (0.1.0)
  • Installing pluggy (1.0.0)
  • Installing py (1.11.0)
  • Installing qdldl (0.1.5.post2)
  • Installing requests (2.27.1)
  • Installing tomli (2.0.1)
  • Installing click (8.1.3)
  • Installing coverage (6.3.3)
  • Installing cycler (0.11.0)
  • Installing ecos (2.0.10)
  • Installing fonttools (4.33.3)
  • Installing joblib (1.1.0)
  • Installing jupyterlab-server (2.14.0)
  • Installing kiwisolver (1.4.2)
  • Installing lxml (4.8.0)
  • Installing mccabe (0.6.1)
  • Installing multitasking (0.0.10)
  • Installing mypy-extensions (0.4.3)
  • Installing nbclassic (0.3.7)
  • Installing osqp (0.6.2.post5)
  • Installing pandas (1.4.2)
  • Installing pathspec (0.9.0)
  • Installing pillow (9.1.1)
  • Installing platformdirs (2.5.2)
  • Installing pycodestyle (2.8.0)
  • Installing pyflakes (2.4.0)
  • Installing pytest (7.1.2)
  • Installing scs (3.2.0)
  • Installing setuptools-scm (6.4.2)
  • Installing threadpoolctl (3.1.0)
  • Installing typing-extensions (4.2.0)
  • Installing black (22.3.0)
  • Installing cvxpy (1.2.1)
  • Installing flake8 (4.0.1)
  • Installing jupyterlab (3.4.2)
  • Installing matplotlib (3.5.2)
  • Installing pytest-cov (3.0.0)
  • Installing scikit-learn (1.1.1)
  • Installing yfinance (0.1.70)
Removing intermediate container 4ca614687435
 ---> e63d95d9abbf
Step 5/6 : COPY . .
 ---> 338107e3eced
Step 6/6 : RUN cd cookbooks
 ---> Running in 2cf8b86beeec
/bin/sh: 1: cd: can't cd to cookbooks
The command '/bin/sh -c cd cookbooks' returned a non-zero code: 2
$ ls cookbooks
1-RiskReturnModels.ipynb            3-Advanced-Mean-Variance-Optimisation.ipynb  5-Hierarchical-Risk-Parity.ipynb
2-Mean-Variance-Optimisation.ipynb  4-Black-Litterman-Allocation.ipynb           data
robertmartin8 commented 1 year ago

I don't know enough about docker to fix this unfortunately – if anyone does, a PR would be much appreciated!

88d52bdba0366127fffca9dfa93895 commented 1 year ago

Agree with @yosukesan, it simply removes that s. @robertmartin8 pls check this PR: https://github.com/robertmartin8/PyPortfolioOpt/pull/498

88d52bdba0366127fffca9dfa93895 commented 1 year ago

merged and fixed it, close the issue.