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

ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package #477

Closed
kevinapetrei opened this issue Feb 12, 2020 · 21 comments

Comments

@kevinapetrei
Copy link

from binance.client import Client

ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package

I've just done: pip install python-binance.

please help!

@oliver-zehentleitner
Copy link
Contributor

Maybe you have python2 and python3 on your system?

PIP has installed python-binance for python2 and your script runs with python3?

try python3 -m pip install python-binance and take care your script runs with python3 too!

@mrjonesev
Copy link

mrjonesev commented Apr 6, 2020

Same here, I've tried both 2 and 3 none of them worked.

@Flowelfox
Copy link

Same here, python3.6 not working

@nikhil-kankarla
Copy link

If you're running the import statement from within a file called binance.py, this will be relevant for you

@grantbelford
Copy link

Dear all,
fyi. I was able to solve this problem by adding Binance Folder path to environment variables:

  1. Environment Variables: add
    PYTHONPATH
    C:\Users\user\Anaconda3\Lib\site-packages\binance; (add a semi-colon at the end)
  2. Restart JupyterNB
    3 . If you run following in JupyterNB you should see the above path added.
    import sys
    sys.path
    Reference: https://www.youtube.com/watch?v=A7E18apPQJs&feature=youtu.be

@janascc
Copy link

janascc commented Feb 1, 2021

Hi all
being able to install the below fixed the issue I had with this error message No module named 'binance.client'; 'binance' is not a package
pip install C:\\Users\\<your user name>\\Downloads\\Twisted-20.3.0-cp39-cp39-win_amd64.whl

.whl source file downloaded from here https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

@samp-reston
Copy link

Is this solved?

@Flowelfox
Copy link

If you're running the import statement from within a file called binance.py, this will be relevant for you

Check this answer, if you have package or file named "binance" this error may occur.

@SpitFire-666
Copy link

Yep, I realised I had a file binance.py in the same directory - after renaming that all good!

@sibdib
Copy link

sibdib commented May 12, 2021

I have this nad I installed everything correctly:
Traceback (most recent call last):

File "D:\Trading\news-analysis.py", line 39, in <module>
   from binance.websockets import BinanceSocketManager
ModuleNotFoundError: No module named 'binance.websockets'

@MykolaIF
Copy link

MykolaIF commented Jun 1, 2021

from binance.client import Client

ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package

I've just done: pip install python-binance.

please help!

I just changed the value "include-system-site-packages" in the file pyvenv.cfg of my project from "false" to "true", and everything worked.

@mohammadizaan
Copy link

I tried a lot of things already here on google but nothing was useful, then I tired pip install python-binance==0.7.5 instead of pip install python-binance==0.7.9, and I was successful to import " from binance.client import Client.

Beside this, I also renamed my two binance.py files as binance.client.py, and it worked for me.

You can find your binance.py files in your python3 site packages folder. Just go there and search binance.py, you will find it.

That's all what I did successfully.

If it is helpful for you , so kindly leave a comment.

@victorkingi
Copy link

Here is something stupid I forgot to do. If you are using Jupyter notebook and Conda environments, make sure the kernel selected is the conda environment having the packages installed, otherwise, it will use the default system python which doesn't have any packages.

After opening a notebook, go to Kernel then change kernel
image

If your conda environment isn't listed, follow this steps:

  1. Run conda install -c anaconda ipykernel . You might need to run as administrator in windows 10/11
  2. Run python -m ipykernel install --user --name=firstEnv where firstEnv is your environment name.
  3. Restart jupyter notebook and you should now have a new kernel under change kernel with your conda env name.

Cheers! :)

@k8p8sz
Copy link

k8p8sz commented Sep 25, 2021

From me the solution was simple:
somehow there was a binance.py file in the site-packages folder, I just renamed it to something else, and restarted kernel.

...\Anaconda3\envs"name of your your env"\lib\site-packages\binance.py

@swiftwuz
Copy link

swiftwuz commented Mar 9, 2022

If you're running the import statement from within a file called binance.py, this will be relevant for you

this saved my life thank you

@hurleyhan888
Copy link

A very simple fix for me...just make sure your python code IS NOT saved in a file called binance.py...i renamed mine and it worked smoothly, seems the module requires that filename and that creates some conflict. Hope this helps

@mrhouzlane
Copy link

It is not working work me is this import deprecated ?

I found this : from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager

@FedericoMurtula
Copy link

from binance.client import Client

ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package
I've just done: pip install python-binance.
please help!

I just changed the value "include-system-site-packages" in the file pyvenv.cfg of my project from "false" to "true", and everything worked.

it worked after tried a lot of things. Thanks !!

@topereacts
Copy link

i cant still find a solution after trying all these

@coolmib
Copy link

coolmib commented Jan 30, 2023

i cant still find a solution after trying all these

Try : from binance.streams import BinanceSocketManager

@mailsonpuc
Copy link

O nome do arquivo.py que você criou não pode se binance, mude para outro nome que funciona.

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