Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'create_connection' from 'websocket' #14

Open
sergeiwallace opened this issue Oct 22, 2021 · 3 comments

Comments

@sergeiwallace
Copy link

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?

@superMDguy
Copy link

Running pip install websocket-client==0.44.0 fixed it for me

@bryanroth
Copy link

I'm still getting this exception even when using websocket-client version 0.44.0.

@joeantonelli
Copy link

Running pip install websocket-client==0.44.0 fixed it for me

This worked for me as well, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants