whittlem / pycryptobot

Python Crypto Bot (PyCryptoBot)
Apache License 2.0
1.98k stars 741 forks source link

v6.0.0 not start, error import TradingGraphs #675

Closed hellresistor closed 1 year ago

hellresistor commented 2 years ago

Describe the bug Not Run. Return error

To Reproduce Steps to reproduce the behavior:

  1. download and extract https://github.com/whittlem/pycryptobot/releases/tag/6.0.0
  2. cd /home/user/
  3. python3.9 -m pip install -r requirements.txt
  4. python3.9 pycryptobot.py
  5. See error

Expected behavior Start running...

Screenshots errorpycrypto

Desktop (please complete the following information):

Additional context transcript

#python3.9 -m pip install -r requirements.txt 
Requirement already satisfied: urllib3>=1.26.5 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (1.26.8)
Requirement already satisfied: pandas==1.1.4 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (1.1.4)
Requirement already satisfied: requests==2.25.0 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (2.25.0)
Requirement already satisfied: statsmodels==0.12.2 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (0.12.2)
Requirement already satisfied: matplotlib==3.3.3 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 5)) (3.3.3)
Requirement already satisfied: mock==4.0.3 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 6)) (4.0.3)
Requirement already satisfied: pytest==6.2.2 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 7)) (6.2.2)
Requirement already satisfied: pytest-mock==3.6.1 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 8)) (3.6.1)
Requirement already satisfied: responses==0.13.3 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 9)) (0.13.3)
Requirement already satisfied: pyyaml==5.4.1 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 10)) (5.4.1)
Requirement already satisfied: websocket-client==0.59.0 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 11)) (0.59.0)
Requirement already satisfied: websockets==9.1 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 12)) (9.1)
Requirement already satisfied: flask in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 13)) (2.0.2)
Requirement already satisfied: python-telegram-bot==13.7 in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 14)) (13.7)
Requirement already satisfied: tradingview-ta in /home/user/.local/lib/python3.9/site-packages (from -r requirements.txt (line 15)) (3.2.10)
Requirement already satisfied: pytz>=2017.2 in /home/user/.local/lib/python3.9/site-packages (from pandas==1.1.4->-r requirements.txt (line 2)) (2021.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /usr/lib/python3/dist-packages (from pandas==1.1.4->-r requirements.txt (line 2)) (2.7.3)
Requirement already satisfied: numpy>=1.15.4 in /home/user/.local/lib/python3.9/site-packages (from pandas==1.1.4->-r requirements.txt (line 2)) (1.22.2)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests==2.25.0->-r requirements.txt (line 3)) (2019.11.28)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/lib/python3/dist-packages (from requests==2.25.0->-r requirements.txt (line 3)) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python3/dist-packages (from requests==2.25.0->-r requirements.txt (line 3)) (2.8)
Requirement already satisfied: scipy>=1.1 in /home/user/.local/lib/python3.9/site-packages (from statsmodels==0.12.2->-r requirements.txt (line 4)) (1.8.0)
Requirement already satisfied: patsy>=0.5 in /home/user/.local/lib/python3.9/site-packages (from statsmodels==0.12.2->-r requirements.txt (line 4)) (0.5.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/user/.local/lib/python3.9/site-packages (from matplotlib==3.3.3->-r requirements.txt (line 5)) (1.3.2)
Requirement already satisfied: pillow>=6.2.0 in /usr/lib/python3/dist-packages (from matplotlib==3.3.3->-r requirements.txt (line 5)) (7.0.0)
Requirement already satisfied: cycler>=0.10 in /home/user/.local/lib/python3.9/site-packages (from matplotlib==3.3.3->-r requirements.txt (line 5)) (0.11.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/lib/python3/dist-packages (from matplotlib==3.3.3->-r requirements.txt (line 5)) (2.4.6)
Requirement already satisfied: py>=1.8.2 in /home/user/.local/lib/python3.9/site-packages (from pytest==6.2.2->-r requirements.txt (line 7)) (1.11.0)
Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (from pytest==6.2.2->-r requirements.txt (line 7)) (20.3)
Requirement already satisfied: pluggy<1.0.0a1,>=0.12 in /home/user/.local/lib/python3.9/site-packages (from pytest==6.2.2->-r requirements.txt (line 7)) (0.13.1)
Requirement already satisfied: attrs>=19.2.0 in /home/user/.local/lib/python3.9/site-packages (from pytest==6.2.2->-r requirements.txt (line 7)) (21.4.0)
Requirement already satisfied: iniconfig in /home/user/.local/lib/python3.9/site-packages (from pytest==6.2.2->-r requirements.txt (line 7)) (1.1.1)
Requirement already satisfied: toml in /home/user/.local/lib/python3.9/site-packages (from pytest==6.2.2->-r requirements.txt (line 7)) (0.10.2)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from responses==0.13.3->-r requirements.txt (line 9)) (1.14.0)
Requirement already satisfied: itsdangerous>=2.0 in /home/user/.local/lib/python3.9/site-packages (from flask->-r requirements.txt (line 13)) (2.0.1)
Requirement already satisfied: Werkzeug>=2.0 in /home/user/.local/lib/python3.9/site-packages (from flask->-r requirements.txt (line 13)) (2.0.3)
Requirement already satisfied: click>=7.1.2 in /home/user/.local/lib/python3.9/site-packages (from flask->-r requirements.txt (line 13)) (8.0.3)
Requirement already satisfied: Jinja2>=3.0 in /home/user/.local/lib/python3.9/site-packages (from flask->-r requirements.txt (line 13)) (3.0.3)
Requirement already satisfied: APScheduler==3.6.3 in /home/user/.local/lib/python3.9/site-packages (from python-telegram-bot==13.7->-r requirements.txt (line 14)) (3.6.3)
Requirement already satisfied: cachetools==4.2.2 in /home/user/.local/lib/python3.9/site-packages (from python-telegram-bot==13.7->-r requirements.txt (line 14)) (4.2.2)
Requirement already satisfied: tornado>=6.1 in /home/user/.local/lib/python3.9/site-packages (from python-telegram-bot==13.7->-r requirements.txt (line 14)) (6.1)
Requirement already satisfied: MarkupSafe>=2.0 in /home/user/.local/lib/python3.9/site-packages (from Jinja2>=3.0->flask->-r requirements.txt (line 13)) (2.0.1)
Requirement already satisfied: tzlocal>=1.2 in /home/user/.local/lib/python3.9/site-packages (from APScheduler==3.6.3->python-telegram-bot==13.7->-r requirements.txt (line 14)) (4.1)
Requirement already satisfied: setuptools>=0.7 in /usr/lib/python3/dist-packages (from APScheduler==3.6.3->python-telegram-bot==13.7->-r requirements.txt (line 14)) (45.2.0)
Requirement already satisfied: pytz-deprecation-shim in /home/user/.local/lib/python3.9/site-packages (from tzlocal>=1.2->APScheduler==3.6.3->python-telegram-bot==13.7->-r requirements.txt (line 14)) (0.1.0.post0)
Requirement already satisfied: tzdata; python_version >= "3.6" in /home/user/.local/lib/python3.9/site-packages (from pytz-deprecation-shim->tzlocal>=1.2->APScheduler==3.6.3->python-telegram-bot==13.7->-r requirements.txt (line 14)) (2021.5)
#python3.9 pycryptobot.py 
Traceback (most recent call last):
  File "/home/user/Desktop/pycryptobot-main/pycryptobot.py", line 27, in <module>
    from views.TradingGraphs import TradingGraphs
  File "/home/user/Desktop/pycryptobot-main/views/TradingGraphs.py", line 5, in <module>
    import matplotlib.pyplot as plt
  File "/home/user/.local/lib/python3.9/site-packages/matplotlib/pyplot.py", line 36, in <module>
    import matplotlib.colorbar
  File "/home/user/.local/lib/python3.9/site-packages/matplotlib/colorbar.py", line 44, in <module>
    import matplotlib.contour as contour
  File "/home/user/.local/lib/python3.9/site-packages/matplotlib/contour.py", line 17, in <module>
    import matplotlib.text as text
  File "/home/user/.local/lib/python3.9/site-packages/matplotlib/text.py", line 16, in <module>
    from .textpath import TextPath  # Unused, but imported by others.
  File "/home/user/.local/lib/python3.9/site-packages/matplotlib/textpath.py", line 11, in <module>
    from matplotlib.mathtext import MathTextParser
  File "/home/user/.local/lib/python3.9/site-packages/matplotlib/mathtext.py", line 27, in <module>
    from PIL import Image
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/__init__.py)
warrmr commented 2 years ago

It looks like it could be a missing dependancy, I had similar issues when working through the install for ARM installing these packages did the trick.

apt-get install build-essential libatlas3-base \ 
libfreetype6 libjpeg62-turbo \
libopenjp2-7 libtiff5 libxcb1
warrmr commented 2 years ago

There is quite a bit of information on the dependancies in a separate fork by https://github.com/paulbruedgam

https://github.com/paulbruedgam/pycryptobot/blob/docker/Dockerfile

This gives you more specific details on which packages have which dependancies, but the commands in my previous answer should cover out most of them.

# Update the base image and install requirements
# - Base build tools
#   - build-essentials: contains build tools (e.g. gcc or g++) you need to build Python extensions
#   - python3-dev: contains the header files you need to build Python extensions (needed for ARM)
#
# - Pillow (https://pillow.readthedocs.io/en/stable/installation.html#building-on-linux)
#   - Python packages: setuptools tk
#   - Linux packages (dev): libfreetype6-dev libfribidi-dev libharfbuzz-dev libjpeg62-turbo-dev
#                           liblcms2-dev libopenjp2-7-dev libtiff5-dev libwebp-dev libxcb1-dev
#                           tcl8.6-dev tk8.6-dev zlib1g-dev
#
#   - Linux packages (prod): libfreetype6 libjpeg62-turbo libopenjp2-7 libtiff5 libxcb1
#
# - matplotlib (https://matplotlib.org/stable/devel/dependencies.html)
#   - Python packages: NumPy, Pillow
#   - Linux packages (dev): gcc libfreetype6-dev
#   - ToDo:
#       - https://matplotlib.org/stable/devel/testing.html#run-the-tests
#       - Evaluate python3 -m pytest --pyargs matplotlib.tests
#
# - NumPy (https://numpy.org/devdocs/user/building.html)
#   - Python packages: Cython
#   - Linux packages (dev): gcc gfortran libatlas-base-dev liblapack-dev libopenblas-dev
#   - Linux packages (prod): libatlas3-base libopenblas-base
#   - ToDo:
#       - https://numpy.org/devdocs/dev/development_environment.html#running-tests
#       - Evaluate python3 -c 'import numpy as np; np.test("full", verbose=2)'
#
# - pandas (https://pandas.pydata.org/docs/getting_started/install.html#dependencies)
#   - Python packages: NumPy, python-dateutil, pytz
#   - ToDo:
#       - https://pandas.pydata.org/docs/getting_started/install.html#running-the-test-suite
#       - Evaluate python3 -c 'import pandas as pd; pd.test()'
#
# - scipy (https://scipy.github.io/devdocs/building/linux.html#id1)
#   - Linux packages (dev): gcc g++ gfortran liblapack-dev libopenblas-dev
#   - Linux packages (prod): libatlas3-base libopenblas-base
#
# - statsmodels (https://www.statsmodels.org/stable/install.html)
#   - Python packages: Cython, NumPy, Pandas, SciPy, Patsy
#
# Note: OpenBLAS packages not available on all arm versions. Using libblas-dev and libblas3 instead
#
hellresistor commented 2 years ago

cannot find this package libjpeg62-turbo-dev just libjpeg62-dev and keeps same error :S

EDIT: Maybe system issue... retry with a new&clean OS

warrmr commented 2 years ago

cannot find this package libjpeg62-turbo-dev just libjpeg62-dev and keeps same error :S

EDIT: Maybe system issue... retry with a new&clean OS

How did you get on?

I have found this post that suggests multiple installs of Pillow will do a similar thing. https://stackoverflow.com/questions/25340698/importerror-cannot-import-name-imaging

They suggest cleaning out this folder and trying to install the requirements.txt again :) /usr/lib/python3/dist-packages

Keep us updated on your progress. If you need any assists Holla! :)