python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

ImportError: No module named 'binance'

Open mark-antony1 opened this issue 8 years ago • 7 comments

Hi Guys,

Trying to get passed an import error. I have seen similar import error being reported that seem to stem from conflicting files/directories in the path, however I believe the error is something different.

I initially tried doing

from binance.client import Client

which threw the ImportError: No module named 'binance'. This file was nestled a few directories deep, but i did not name any files or directories 'binance'. I then decided to create a blank file at the root of the directory and try to run

import binance

This attempt also threw the same error

ImportError: No module named 'binance

I am struggling to find the issue now, I have tried to install 'python-binance' and 'python-binance-api' individually with pip and still i have this issue. I am running on Ubuntu 16.04.5.

Thanks.

mark-antony1 avatar Aug 09 '18 06:08 mark-antony1

Are you using python 2 or 3, if so you might just need to do pip3 install python-binance or just do python -m pip install SomePackage to make sure you don't have multiple versions of pip messing it up

K-Kit avatar Aug 14 '18 23:08 K-Kit

try sudo -H pip install python-binance. (on python 2.x) or sudo -H pip3 install python-binance (on python 3.x)

freskpe avatar Mar 17 '19 22:03 freskpe

Thanks @K-Kit , doing python -m pip install SomePackage works in my case.

priyakumariengineer avatar Aug 11 '19 14:08 priyakumariengineer

@priyakumariengineer Was this by any chance because you had anaconda running elsewhere?

Nsandomeno avatar Mar 01 '20 06:03 Nsandomeno

i suppose installing thru pip is unrelated to library itself. closing.

kimchirichie avatar Nov 19 '20 02:11 kimchirichie

I had a similar issue, for me the problem was my IDE was trying to run the code in a different version of python than that of the library. Running manually from terminal python3 bot.py worked

aerrowfar avatar Jan 23 '21 22:01 aerrowfar

I had a similar issue, for me the problem was my IDE was trying to run the code in a different version of python than that of the library. Running manually from terminal python3 bot.py worked

yes this as well worked for me. Then, restarting VS in my venv and it's back to normal.

J-cyber0 avatar Jul 19 '21 15:07 J-cyber0