mhallsmoore / qstrader

QuantStart.com - QSTrader backtesting simulation engine.
https://www.quantstart.com/qstrader/
MIT License
2.84k stars 851 forks source link

Unable to install qstrader #345

Closed harishiyer2020 closed 5 months ago

harishiyer2020 commented 3 years ago

Hi I am using the latest version of Anaconda (2020/11) on Windows 10. I am unable to install qstrader. Have tried everything. Please help. Thank you! FYI I am getting the following error:

 ERROR: Failed building wheel for matplotlib
  Running setup.py clean for matplotlib
Failed to build matplotlib
Installing collected packages: matplotlib, pandas, seaborn, qstrader
    Running setup.py install for matplotlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\hari\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hari\\AppData\\Local\\Temp\\pip-install-z2kx9ptz\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\hari\\AppData\\Local\\Temp\\pip-install-z2kx9ptz\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\hari\AppData\Local\Temp\pip-record-swqqseu4\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\hari\AppData\Roaming\Python\Python38\Include\matplotlib'
         cwd: C:\Users\hari\AppData\Local\Temp\pip-install-z2kx9ptz\matplotlib\

 Complete output (55 lines):
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [3.0.3]
                    python: yes [3.8.5 (default, Sep  3 2020, 21:29:08) [MSC
                            v.1916 64 bit (AMD64)]]
                  platform: yes [win32]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.18.4]
          install_requires: yes [handled by setuptools]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: yes [Using unknown version found on system.]
                       png: yes [Using unknown version found on system.]
                     qhull: yes [pkg-config information for 'libqhull' could not
                            be found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: no  [skipping due to configuration]
            toolkits_tests: no  [skipping due to configuration]

    OPTIONAL BACKEND EXTENSIONS
                       agg: yes [installing]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                    macosx: no  [Mac OS-X only]
                 windowing: yes [installing]

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    running install
    running build
    running build_py
    copying lib\matplotlib\mpl-data\matplotlibrc -> build\lib.win-amd64-3.8\matplotlib\mpl-data
    UPDATING build\lib.win-amd64-3.8\matplotlib\_version.py
    set build\lib.win-amd64-3.8\matplotlib\_version.py to '3.0.3'
    running build_ext
    building 'matplotlib._png' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib__png_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -IC:\Users\ishwa\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\hari\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\hari\anaconda3\Library\include -I. -IC:\Users\hari\anaconda3\include -IC:\Users\hari\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpsrc/_png.cpp /Fobuild\temp.win-amd64-3.8\Release\src/_png.obj
    _png.cpp
    src/_png.cpp(336): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
    src/_png.cpp(318): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib__png_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -IC:\Users\hari\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\hari\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\hari\anaconda3\Library\include -I. -IC:\Users\hari\anaconda3\include -IC:\Users\hari\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpsrc/mplutils.cpp /Fobuild\temp.win-amd64-3.8\Release\src/mplutils.obj
    mplutils.cpp
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\hari\anaconda3\Library\lib /LIBPATH:C:\Users\hari\anaconda3\libs /LIBPATH:C:\Users\hari\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" png.lib z.lib /EXPORT:PyInit__png build\temp.win-amd64-3.8\Release\src/_png.obj build\temp.win-amd64-3.8\Release\src/mplutils.obj /OUT:build\lib.win-amd64-3.8\matplotlib\_png.cp38-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.8\Release\src\_png.cp38-win_amd64.lib
    LINK : fatal error LNK1181: cannot open input file 'png.lib'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181

ERROR: Command errored out with exit status 1: 'C:\Users\hari\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hari\\AppData\\Local\\Temp\\pip-install-z2kx9ptz\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\hari\\AppData\\Local\\Temp\\pip-install-z2kx9ptz\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\hari\AppData\Local\Temp\pip-record-swqqseu4\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\hari\AppData\Roaming\Python\Python38\Include\matplotlib' Check the logs for full command output.

mhallsmoore commented 3 years ago

Hi @harishiyer2020,

A similar issue has come up elsewhere recently: https://github.com/mhallsmoore/qstrader/issues/344

The logs above seem to suggest that the png library is unable to be found and this is causing the failure.

While I have not tested this potential fix, it may be due to using matplotlib==3.0.3, which is the version I've listed in requirements.txt. If you install the latest version of matplotlib (e.g. run pip install matplotlib==3.3.3) prior to running pip install qstrader, this may fix the issue.

Kind regards,

Mike.

shang2021 commented 3 years ago

Hi @harishiyer2020 I meet the same issue when installing. Running 'conda install python=3.7' in the terminal window solves my problem. It is due to python 3.8 is not compatible with matplotlib 3.0.3. It seems version 3.7 or earlier has no problem to install matplotlib 3.0.3 which is required by qstrader. Best regards, Weifeng

fanjunhua1228 commented 3 years ago

Hi Thanks for your answer shanghai2021.

best wishes

Junhua Fan

harishiyer2020 commented 2 years ago

Many thanks for your email. This was very helpful. Wish you a happy new year! Best Harish

On Wed, 13 Jan 2021 at 08:54, shang2021 @.***> wrote:

Hi @harishiyer2020 https://github.com/harishiyer2020 I meet the same issue when installing. Running 'conda install python=3.7' in the terminal window solves my problem. It is due to python 3.8 is not compatible with matplotlib 3.0.3. It seems version 3.7 or earlier has no problem to install matplotlib 3.0.3 which is required by qstrader. Best regards, Weifeng

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mhallsmoore/qstrader/issues/345#issuecomment-759179537, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR7RHV2KXHWIUBFRFZ2RLQ3SZUG7XANCNFSM4UMEITDA .