Python-binance: Exceptions while trying to `pip3 install python-binance`

Created on 11 Apr 2018  路  4Comments  路  Source: sammchardy/python-binance

I was trying to install it, but now i don't know what to do.
After that i was trying to import binance at python shell, but "no module named binance", obviously.
I am running debian, python 3.5.3, pip 9.0.1, if it helps somehow.
Here is the full pip's output:

pi@raspberry:~ $ pip3 install python-binance
Collecting python-binance
  Downloading python_binance-0.6.8-py2.py3-none-any.whl
Collecting autobahn (from python-binance)
  Downloading autobahn-18.4.1-py2.py3-none-any.whl (293kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 296kB 129kB/s 
Collecting certifi (from python-binance)
  Using cached certifi-2018.1.18-py2.py3-none-any.whl
Collecting six (from python-binance)
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting urllib3 (from python-binance)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting pyOpenSSL (from python-binance)
  Downloading pyOpenSSL-17.5.0-py2.py3-none-any.whl (53kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 61kB 298kB/s 
Collecting requests (from python-binance)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting cryptography (from python-binance)
  Downloading cryptography-2.2.2-cp34-abi3-manylinux1_i686.whl (2.0MB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 2.0MB 106kB/s 
Collecting dateparser (from python-binance)
  Downloading dateparser-0.7.0-py2.py3-none-any.whl (357kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 358kB 222kB/s 
Collecting service-identity (from python-binance)
  Downloading service_identity-17.0.0-py2.py3-none-any.whl
Collecting chardet (from python-binance)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting Twisted (from python-binance)
  Downloading Twisted-17.9.0.tar.bz2 (3.0MB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 3.0MB 16kB/s 
Collecting txaio>=2.10.0 (from autobahn->python-binance)
  Downloading txaio-2.10.0-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->python-binance)
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography->python-binance)
  Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 102kB 355kB/s 
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography->python-binance)
  Downloading cffi-1.11.5-cp35-cp35m-manylinux1_i686.whl (397kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 399kB 207kB/s 
Collecting regex (from dateparser->python-binance)
  Downloading regex-2018.02.21.tar.gz (620kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 624kB 166kB/s 
Collecting tzlocal (from dateparser->python-binance)
  Downloading https://www.piwheels.org/simple/tzlocal/tzlocal-1.5.1-py3-none-any.whl
Collecting python-dateutil (from dateparser->python-binance)
  Downloading python_dateutil-2.7.2-py2.py3-none-any.whl (212kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 215kB 215kB/s 
Collecting pytz (from dateparser->python-binance)
  Downloading pytz-2018.4-py2.py3-none-any.whl (510kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 512kB 103kB/s 
Collecting pyasn1-modules (from service-identity->python-binance)
  Downloading pyasn1_modules-0.2.1-py2.py3-none-any.whl (60kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 61kB 295kB/s 
Collecting attrs (from service-identity->python-binance)
  Downloading attrs-17.4.0-py2.py3-none-any.whl
Collecting pyasn1 (from service-identity->python-binance)
  Downloading pyasn1-0.4.2-py2.py3-none-any.whl (71kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 71kB 243kB/s 
Collecting Automat>=0.3.0 (from Twisted->python-binance)
  Downloading Automat-0.6.0-py2.py3-none-any.whl
Collecting constantly>=15.1 (from Twisted->python-binance)
  Downloading constantly-15.1.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from Twisted->python-binance)
  Downloading hyperlink-18.0.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from Twisted->python-binance)
  Downloading incremental-17.5.0-py2.py3-none-any.whl
Collecting zope.interface>=4.0.2 (from Twisted->python-binance)
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Most helpful comment

Here's a fix that worked for me on Raspbian: sudo pip --default-timeout=1000 install (package name)
In your case: sudo pip --default-timeout=1000 install python-binance

All 4 comments

Was trying to pip3 install --upgrade requests, as here noticed. Same error, different traceback:

pi@raspberry:~ $ pip3 install python-binance
Collecting python-binance
  Using cached python_binance-0.6.8-py2.py3-none-any.whl
Collecting cryptography (from python-binance)
  Using cached cryptography-2.2.2-cp34-abi3-manylinux1_i686.whl
Collecting pyOpenSSL (from python-binance)
  Using cached pyOpenSSL-17.5.0-py2.py3-none-any.whl
Collecting Twisted (from python-binance)
  Using cached Twisted-17.9.0.tar.bz2
Collecting urllib3 (from python-binance)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting dateparser (from python-binance)
  Using cached dateparser-0.7.0-py2.py3-none-any.whl
Collecting service-identity (from python-binance)
  Using cached service_identity-17.0.0-py2.py3-none-any.whl
Collecting autobahn (from python-binance)
  Using cached autobahn-18.4.1-py2.py3-none-any.whl
Collecting requests (from python-binance)
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Here's a fix that worked for me on Raspbian: sudo pip --default-timeout=1000 install (package name)
In your case: sudo pip --default-timeout=1000 install python-binance

Well.

Problem was solved by using virtualenv (documentation, using pip within virtualenv).

This problem have no relation to python-binance, because it is a pip failures. There is two different reasons, causes such type of error:
1) tricky proxy settings
2) tricky pip package, somehow distorted by mainteiners of debian packages, so all debian derivatives were suffered.

just upgrade relative packages
like: python3 -m pip install --user --upgrade requests

Was this page helpful?
0 / 5 - 0 ratings