gemini-python
gemini-python copied to clipboard
ImportError: cannot import name 'create_connection' from 'websocket'
I ran pip install gemini_python but when I try to run the following simple script to place an order:
import gemini
import secrets
def main():
r = gemini.PrivateClient(secrets.api_key, secrets.api_secret)
r.new_order("XTZUSD", "250", "6.6281", "buy")
if __name__ == '__main__':
main()
I get the error:
Traceback (most recent call last):
File "/Users/sergeiwallace/PycharmProjects/GeminiAPI/main.py", line 1, in <module>
import gemini
File "/Users/sergeiwallace/PycharmProjects/GeminiAPI/venv/lib/python3.9/site-packages/gemini/__init__.py", line 3, in <module>
from .basewebsocket import BaseWebSocket
File "/Users/sergeiwallace/PycharmProjects/GeminiAPI/venv/lib/python3.9/site-packages/gemini/basewebsocket.py", line 9, in <module>
from websocket import create_connection, WebSocketConnectionClosedException
ImportError: cannot import name 'create_connection' from 'websocket' (/Users/sergeiwallace/PycharmProjects/GeminiAPI/venv/lib/python3.9/site-packages/websocket/__init__.py)
I've explicitly run pip install websocket-client but it says it's already installed.
Anyone know what the issue is?
Running pip install websocket-client==0.44.0 fixed it for me
I'm still getting this exception even when using websocket-client version 0.44.0.
Running
pip install websocket-client==0.44.0fixed it for me
This worked for me as well, thanks.