0

I'm trying to make some api calls from the Binance Exchange and do some live calculations, displaying results in a window. I have spent 4 hours and am still getting the same error. There is no other documentation to suggest I am doing anything wrong - unless I have installed the pip Binance wrongly? I am new to python and APIs so I would no know where to start with command prompt pip issues.

renaming file, installing pip3 commands, a bunch of other pip commands.

from tkinter import *
from binance.client import BinanceRESTAPI, BinanceWebSocketAPI
#And I have tried renaming my file test_app.py nothing works

bina = Binance()

rest_client = BinanceRESTAPI(pub_APIKEY, pvt_APIKEY)
ws_client = BinanceWebSocketAPI(pub_APIKEY)

master = Tk()
master.geometry("480x360")


mainloop( )

I get the following exception:

ModuleNotFoundError
No module named 'binance'
    File "/Users/tha-messenja/blockchaintutorial/test_app.py", line 2, in <module>
from binance.client import BinanceRESTAPI, BinanceWebSocketAPI
Nikolas Stevenson-Molnar
  • 4,235
  • 1
  • 22
  • 31
Bandit266
  • 1
  • 3

1 Answers1

2

You haven't installed that binance package.

I suggest you using virtual environments, like this:

python3 -m venv test_env
source test_env/bin/activate  # Linux
# test_env/Scripts/activate.bat  # Windows
python -m pip install binance
ipaleka
  • 3,745
  • 2
  • 13
  • 33
  • I agree that using a virtual environment is a good solution for seasoned python developers, but is it really the best solution for someone who is just starting out with it and is having problems getting a single dependency to work? – Junuxx Jun 26 '19 at 16:46
  • Dunno, really, I think no project should exist in development without being in a separate virtual environment. He works on a project implementing GUI and server calls - that's trivial and beginnerish just because Python made it such. – ipaleka Jun 26 '19 at 16:53
  • I do think that virtual environments save a lot of headache, even for new users. Even better: `pipenv`. – Nikolas Stevenson-Molnar Jun 26 '19 at 17:34