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

Cannot import name 'AsyncClient' from 'binance'

Open JugglingCat opened this issue 5 years ago • 3 comments

Hi Sam, I've been trying your wrapper over the past few days and its been great. Today, I decided to use the asyncio feature that you are working on and went through your async example on https://github.com/sammchardy/python-binance/tree/feature/asyncio . I get issues when I run:

from binance import AsyncClient, DepthCacheManager, BinanceSocketManager

which results in the following errors:

cannot import name 'BinanceSocketManager' from 'binance' cannot import name 'AsyncClient' from 'binance' cannot import name 'DepthCacheManager' from 'binance'

I can solve two of these errors by reverting back to past examples and using:

from binance.websockets import BinanceSocketManager from binance.depthcache import DepthCacheManager

But I don't know how to import the AsyncClient

Any ideas?

JugglingCat avatar May 21 '20 13:05 JugglingCat

You need to install the feature/asyncio branch.

You got two choices. If you use virtual environments create a new environment and install the branch directly:

pip install https://github.com/sammchardy/python-binance/archive/feature/asyncio.zip

Or, download and install from source:

git clone https://github.com/sammchardy/python-binance
cd python-binance

git fetch origin
git checkout -t origin/feature/asyncio

pip install -e .

You can now switch branches and it will switch the versions automatically on all python-binance installations you have on your system via the -e flag.


@sammchardy Excuse my random appearance. Coming StackOverflow due to this post. Good luck on the project.

synchronizing avatar May 22 '20 01:05 synchronizing

You need to install the feature/asyncio branch.

You got two choices. If you use virtual environments create a new environment and install the branch directly:

pip install https://github.com/sammchardy/python-binance/archive/feature/asyncio.zip

Or, download and install from source:

git clone https://github.com/sammchardy/python-binance
cd python-binance

git fetch origin
git checkout -t origin/feature/asyncio

pip install -e .

You can now switch branches and it will switch the versions automatically on all python-binance installations you have on your system via the -e flag.

@sammchardy Excuse my random appearance. Coming StackOverflow due to this post. Good luck on the project.

I tried the second option, but after the checkout command, all I got was: "fatal: 'origin/asyncio' is not a commit and a branch 'asyncio' cannot be created from it". What did I miss? Thanks!

ziniec avatar Jun 23 '21 23:06 ziniec

The branck origin/feature/asyncio does not exist therefore the solutions proposed above won't work

Did you solved your problem ?

FoRavel avatar Sep 11 '22 21:09 FoRavel