-1

UPDATE 1: I am installing python-binance on a Linux AWS EC2 instance and get the following error when I try to install python-binance using pip3 in Python 3.7.0rc1. I used the following command.

sudo pip3 install python-binance

Everything is fine installing the package until this partial following output.

Running setup.py install for pycparser ... done
  Running setup.py install for regex ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e8t4_b4g/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-0m6ommln-record/install-record.txt --single-version-externally-managed --compile:
    /usr/lib/python3.7/site-packages/setuptools/dist.py:355: UserWarning: Normalizing '2018.07.11' to '2018.7.11'
      normalized_version,
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    copying regex_3/regex.py -> build/lib.linux-x86_64-3.7
    copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.7
    copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.7
    running build_ext
    building '_regex' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/regex_3
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -fPIC -I/usr/include/python3.7m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.7/regex_3/_regex.o
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e8t4_b4g/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-0m6ommln-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-e8t4_b4g/regex/

I've installed python-binance successfully on both Mac and Windows machines before and can't figure out what's going on.

I then installed gcc as per comments below and am getting the following errors:

Requirement already satisfied: python-binance in /usr/lib/python2.7/site-packages/python_binance-0.7.0-py2.7.egg (0.7.0)
Collecting Twisted (from python-binance)
From cffi callback <function _verify_callback at 0x7f85b053e398>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85ada43398>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85bddc0c80>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85bde6b7d0>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85ada2c140>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85ada2c2a8>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Could not fetch URL https://pypi.org/simple/twisted/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/twisted/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)) - skipping
  Could not find a version that satisfies the requirement Twisted (from python-binance) (from versions: )
No matching distribution found for Twisted (from python-binance)
Matt Ross
  • 21
  • 1
  • 6
  • `unable to execute 'gcc': No such file or directory`. maybe you need to install `gcc`? `sudo apt-get install gcc` – aydow Aug 09 '18 at 04:22
  • Tried that, seemed o be making progress then it timed out due to SSL. I restarted the instance and now am having more SSL issues. I'll report back once I get everything working again. – Matt Ross Aug 09 '18 at 05:06
  • maybe have a chat with aws support regarding your SSL issues. from my experience they're really excellent at resolving the issue but it can take time – aydow Aug 09 '18 at 05:09
  • Fixed. Okay instance is back up. I installed gcc (thanks for that by the way), and now am getting the following errors (see edit above) – Matt Ross Aug 09 '18 at 05:09
  • Possible duplicate of [Error installing prettytable on ubuntu with pip](https://stackoverflow.com/questions/48506436/error-installing-prettytable-on-ubuntu-with-pip) – phd Aug 09 '18 at 09:00
  • https://stackoverflow.com/search?q=%5Bpip%5D+AttributeError%3A+%27module%27+object+has+no+attribute+%27X509_up_ref%27 – phd Aug 09 '18 at 09:00

1 Answers1

0

After it was pointed out I needed to install gcc, that moved things forward, then I found I had SSL errors. I had to do the following:

sudo pip3 uninstall pyopenssl

To remove and upgrade the troublesome package, then:

sudo pip3 uninstall cryptography

And after that python-binance was successfully installed. Issue is it was installed to python 2.7 not 3.7.

Matt Ross
  • 21
  • 1
  • 6