python-binance
python-binance copied to clipboard
Cannot import name 'AsyncClient' from 'binance'
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?
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.
You need to install the
feature/asynciobranch.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.zipOr, 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-binanceinstallations you have on your system via the-eflag.@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!
The branck origin/feature/asyncio does not exist therefore the solutions proposed above won't work
Did you solved your problem ?