STEEM-PYTHON: The long, hard, unecessary, stupid and not finished way to Debian Wheezy

in steem-python •  7 years ago 

What a long title!
It prepares you, what to and what not to expect.
Warning: This is not a tutorial, guide, walk through or whatever. This is just a desaster

My Idea

Some weeks ago, I had the ingenious idea, to try out steem-python on my old Raspberry Pi. Running Debian Wheezy.

The Fun Start

This is going to take some time.
First obstacle, where to find the Pi image for wheezy?
Well, you need to dig deep. Until May of 2015 in their image archive:
https://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/

Donwload and install it on your SD Card with the known methods.

Let's start up our Pi:

Looking good, diving in:

sudo raspi-config

What you see:


Expand your harddisk and move on:

sudo apt-get update
sudo apt-get upgrade
172 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 216 MB of archives.
After this operation, 13.5 MB of additional disk space will be used.

This took another hour.
Now we can start getting to business:

sudo apt-get install screen

And start screen:

screen

Let's find out, what python version the Pi is running:

pi@raspberrypi ~ $ python3
Python 3.2.3 (default, Mar 25 2017, 13:24:50)

Steem-Python needs python3.6, we need to install a new version:

mkdir python
cd python
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

tar xvzf Python-3.6.4.tgz
cd Python-3.6.4/
./configure
make
sudo make altinstall

That was quick, took me 1 hour, to compile, didn't it take longer the last time, I tried womething like this?
Ok, what have we running?

pi@raspberrypi ~/python/Python-3.6.4 $ python3.6
Python 3.6.4 (default, Feb  7 2018, 11:49:27)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

Now we are talking!
Setup the env:

cd
mkdir steem
cd steem
python3.6 -m venv env

And install steem-python

(env) pi@raspberrypi ~/steem $ pip install -U steem
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting steem
  Could not fetch URL https://pypi.python.org/simple/steem/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement steem (from versions: )
No matching distribution found for steem

The Desaster

From this point onwards, it is a train wreck.
I lost focus and my mindset was fixed on solving just one issue.
First very thorough, later just pushing buttons like a drugged up lab monkey

But continuing with our story, we need to look for that SSL thingy:

https://stackoverflow.com/questions/41328451/ssl-module-in-python-is-not-available-when-installing-package-with-pip3

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

cd ../python/Python-3.6.4/
./configure --enable-optimizations
make
sudo make altinstall

I forgot to set the time, but it took some hours/days now to compile

cd
rm -rf steem
mkdir steem
cd steem
python3.6 -m venv env
source env/bin/activate
python -c "import ssl; print(ssl.OPENSSL_VERSION)"

  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/ssl.py", line 101, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'


deactivate

Shitshitshitshitshitsthit
Let's give it another try

cd
mkdir openssl
cd openssl
wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
tar xvzf openssl-1.1.0g.tar.gz
cd openssl-1.1.0g/
./config
make
sudo make install

cd ../../python/Python-3.6.4/
./configure --enable-optimizations
time make
real    847m9.353s
user    825m7.420s
sys     11m52.390s
sudo make altinstall
cd ../../steem
rm -rf *
python3.6 -m venv env
source env/bin/activate
python -c "import ssl; print(ssl.OPENSSL_VERSION)"

  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/ssl.py", line 101, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
deactivate

Another 850 Minutes later and still not working
We need to change the source of Python itself?

cd ../python/Python-3.6.4/
vi Modules/Setup.dist
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c \
 -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
 -L$(SSL)/lib -lssl -lcrypto
 
 ./configure --enable-optimizations
time make
real    774m6.746s
user    752m41.950s
sys     10m41.570s
sudo make altinstall
python3.6 -c "import ssl; print(ssl.OPENSSL_VERSION)"
sudo cp /usr/local/lib/libssl.so.1.1  /usr/lib/
 sudo cp /usr/local/lib/libcrypto.a /usr/lib/
sudo cp /usr/local/lib/libcrypto.so.1.1 /usr/lib/
sudo cp /usr/local/lib/libssl.so  /usr/lib/
vi Modules/Setup.dist
./configure --enable-optimizations
time make

modify 'Setup' file ,change log :

    SSL=/usr/local/openssl
libpython3.6m.a(_ssl.o): In function `sk_SSL_CIPHER_num':
/usr/local/include/openssl/ssl.h:842: undefined reference to `OPENSSL_sk_num'
libpython3.6m.a(_ssl.o): In function `sk_SSL_CIPHER_value':
/usr/local/include/openssl/ssl.h:842: undefined reference to `OPENSSL_sk_value'
libpython3.6m.a(_ssl.o): In function `sk_SSL_CIPHER_num':
/usr/local/include/openssl/ssl.h:842: undefined reference to `OPENSSL_sk_num'
libpython3.6m.a(_ssl.o): In function `_ssl__SSLSocket_peer_certificate_impl':
/home/pi/python/Python-3.6.4/./Modules/_ssl.c:1548: undefined reference to `SSL_is_init_finished'
libpython3.6m.a(_ssl.o): In function `_ssl__SSLContext_load_cert_chain_impl':
/home/pi/python/Python-3.6.4/./Modules/_ssl.c:3294: undefined reference to `SSL_CTX_get_default_passwd_cb'
/home/pi/python/Python-3.6.4/./Modules/_ssl.c:3295: undefined reference to `SSL_CTX_get_default_passwd_cb_userdata'
libpython3.6m.a(_ssl.o): In function `_ssl__SSLContext__set_alpn_protocols_impl':
/home/pi/python/Python-3.6.4/./Modules/_ssl.c:3040: undefined reference to `SSL_CTX_set_alpn_protos'
/home/pi/python/Python-3.6.4/./Modules/_ssl.c:3042: undefined reference to `SSL_CTX_set_alpn_select_cb'
collect2: ld returned 1 exit status
Makefile:563: recipe for target 'python' failed
make[2]: *** [python] Error 1
make[2]: Leaving directory '/home/pi/python/Python-3.6.4'
Makefile:491: recipe for target 'build_all_generate_profile' failed
make[1]: *** [build_all_generate_profile] Error 2
make[1]: Leaving directory '/home/pi/python/Python-3.6.4'
Makefile:472: recipe for target 'profile-opt' failed
make: *** [profile-opt] Error 2

real    63m22.052s
user    61m59.260s
sys     0m44.190s

It has been now 4 days, that I fail at this experiment.
This is, where my wife steps in:
WTF! How long will you keep that thing in our living room? Do you really need to use that LAN cable across the room?

Oh, come on, it's not that bad!

I guess I have to wait some weeks, until I try it again on my Orange Pi...

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

:( hope you get it sorted

I think, it will stay an unfinished work of art;)

This post has been upvoted by @microbot with 23.6%!
Thank you for giving your trust and witness vote to my creator @isnochys!

This post has been upvoted by @minibot with 17.6%!
Thank you for giving your trust and witness vote to my creator @isnochys!

This post has been upvoted by @minibot with 11.1%!
Thank you for giving your trust and witness vote to my creator @isnochys!

This post has received a 3.23% upvote from @aksdwi thanks to: @isnochys.

2.74% @pushup from @isnochys

This post has received a 1.92 % upvote from @boomerang.

You got a 3.69% upvote from @luckyvotes courtesy of @isnochys!

_