DmitryPukhov / pytrade

22 stars 15 forks source link

ImportError: cannot import name 'WebSocketApp' from 'websocket' #6

Closed dsultanr closed 3 years ago

dsultanr commented 3 years ago
$ python App.py
Traceback (most recent call last):
  File "/mnt/talib/pytrade/pytrade/App.py", line 4, in <module>
    from connector.quik.WebQuikBroker import WebQuikBroker
  File "/mnt/talib/pytrade/pytrade/connector/quik/WebQuikBroker.py", line 4, in <module>
    from connector.quik.WebQuikConnector import WebQuikConnector
  File "/mnt/talib/pytrade/pytrade/connector/quik/WebQuikConnector.py", line 5, in <module>
    from websocket import WebSocketApp
ImportError: cannot import name 'WebSocketApp' from 'websocket' (/usr/local/lib/python3.9/site-packages/websocket/__init__.py)

до этого ругалось ModuleNotFoundError: No module named 'websocket'

pip install websocket

Collecting websocket
  Downloading websocket-0.2.1.tar.gz (195 kB)
     |████████████████████████████████| 195 kB 378 kB/s
Collecting gevent
  Downloading gevent-21.1.2-cp39-cp39-manylinux2010_x86_64.whl (6.0 MB)
     |████████████████████████████████| 6.0 MB 46 kB/s
Collecting greenlet
  Downloading greenlet-1.0.0-cp39-cp39-manylinux2010_x86_64.whl (163 kB)
     |████████████████████████████████| 163 kB 103 kB/s
Requirement already satisfied: zope.interface in /usr/local/lib/python3.9/site-packages (from gevent->websocket) (5.2.0)
Collecting zope.event
  Downloading zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (from gevent->websocket) (52.0.0)
Building wheels for collected packages: websocket
  Building wheel for websocket (setup.py) ... done
  Created wheel for websocket: filename=websocket-0.2.1-py3-none-any.whl size=192133 sha256=4951d5e8e167dbcf8d9d516efa2a96bb18db26bc6b0e8a7adac479c4820f1d78
  Stored in directory: /root/.cache/pip/wheels/cd/8c/c5/42beaa658f4825f4dc80634c34c5a4bb564cdd75545346fa93
Successfully built websocket
Installing collected packages: zope.event, greenlet, gevent, websocket
Successfully installed gevent-21.1.2 greenlet-1.0.0 websocket-0.2.1 zope.event-4.5.0
dsultanr commented 3 years ago

решилось удалением дефолтного websocket и установкой нового

# pip uninstall websocket
Found existing installation: websocket 0.2.1
Uninstalling websocket-0.2.1:
  Would remove:
    /usr/local/lib/python3.9/site-packages/websocket-0.2.1.dist-info/*
    /usr/local/lib/python3.9/site-packages/websocket/*
Proceed (y/n)? y
  Successfully uninstalled websocket-0.2.1
# pip install websocket-client==0.37.0
Collecting websocket-client==0.37.0
  Downloading websocket_client-0.37.0.tar.gz (194 kB)
     |████████████████████████████████| 194 kB 311 kB/s
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from websocket-client==0.37.0) (1.15.0)
Building wheels for collected packages: websocket-client
  Building wheel for websocket-client (setup.py) ... done
  Created wheel for websocket-client: filename=websocket_client-0.37.0-py3-none-any.whl size=196980 sha256=03c839db910d89e3d91cd73382fc9488e9be959835e5276ed7305d5e5b4057a2
  Stored in directory: /root/.cache/pip/wheels/78/f2/b6/f251354c4ac953fa4e0eacc3d007652ffcc683ceb733252fce
Successfully built websocket-client
Installing collected packages: websocket-client
Successfully installed websocket-client-0.37.0