Installing Python & Steem-Python on Windows 10!

in #utopian-io7 years ago (edited)

What Will I Learn?

  • You will learn how to install python36 from the Ubuntu Console (In Windows)
  • You will learn how to install and test steem-python

Requirements

Write here a bullet list of the requirements for the user in order to follow this tutorial.

  • Windows 10 version 1607 or later (run winver) 64 Bit

Windows Version

  • Internet Connection
  • Microsoft Account (Sorry, Not My Decision!)

Difficulty

  • Basic

Tutorial Contents

Step 1:

Firstly, we will need to enable developer mode in windows 10, as this feature is considered a 'Developer Feature'.
Open the settings app (Search Bar / Cortana > Settings Trusted Windows Store App)

Settings

Click 'Update & Security'

Update & Security

Click 'For Developers'

For Developers

Select the 'Developer Mode' Radio Button
It will now come up with a dialog asking whether you are sure that you wish to enable developer mode, Select Yes

Confirm Your Choice

Now, go to the updates tab and install any pending updates.

Install Updates

Step 2:

Search for "Turn Windows features on or off", this allows you to enable or disable features that may not be default / good for everyone.
Open it and scroll down to Windows Subsystem for Linux (Beta) or Windows Subsystem for Linux and check the box, this allows us to run ubuntu inside windows.

SS For Linux

Search CMD then when command prompt opens, type bash, this runs the linux console
Next you need to go to the Microsoft Store (Seach > Microsoft Store)
Search for Ubuntu, click on the first one and install it, this is a minified version of ubuntu ready to be used with a console.
Type bash again, accept any licences and continue. When it asks for a username and password, choose whatever you want.
If you need to re-open it after this, just go search / Cortana > Ubuntu or CMD > bash

Step 3:

Now, after bash is installed, make sure you are in the bash console and type the following commands:
If you are not in bash, it will not work!

sudo add-apt-repository ppa:jonathonf/python-3.6

Press Enter when it asks whether to continue
Now we have to update requirements and libraries.

sudo apt-get update

Now we install the correct version.

sudo apt-get install python3.6
Step 5: Steem-Python

Firstly, we need to install the requirement for the library:

sudo apt-get install libssl-dev

Now, all you need to do is install Steem Python:

python3.6 -m pip install steem

If it is successful, you should be able to run

from steem import Steem-Python
steem_instance = Steem()
steem_instance.get_account('cadawg')['sbd_balance']

If it returns something like xx.xxx SBD
Where x is any number (Not all x's have to be the same)

Congratulations, you can now use steem-python, if you want to get started right away, check out:
https://steem.readthedocs.io/en/latest/

Curriculum

This is my first Steem-Python / Python on windows post, so look forward to more soon, but currently, I have no related tutorials!



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

python3.6 -m pip install steem
/usr/bin/python3.6: No module named pip

:(

Answer from stackoverflow:

sudo apt-get install python3-pip

Nevertheless afterwards it still fails at multiple points. It fails to build wheels for ujson, scrypt and of course pycrypto2.6.1

Running setup.py bdist_wheel for scrypt ... error
[...]
src/scrypt.c:28:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for scrypt

A second stackoverflow later:

sudo apt-get install python3.6-dev

Then it seems to work ... at least until the "from steem import ..." I need to investigate further.

Yeah, that seems quite odd. I wish you the best of luck and if you have any other questions, just ask!

Just realised,

from steem import Steem-Python

should be:

from steem import Steem

So Sorry, hope this fixes your problem.
~ @cadawg

sorry, I'm a complete n00b, never programmed python (but I'm over confident and I used to write some mean perl 10 years ago). I suppose this command is a python command, right ? because it certainly isn't a bash one

In python it seems to work :

sorin@AEROBOY:~$ python3.6
Python 3.6.3 (default, Oct 6 2017, 08:44:35)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.

from steem import Steem

Yep, if you replace all the from steem import Steem-Python with from steem import Steem (inside the python code) it should work, so that looks good, now try typing into python after that:

steem_instance = Steem()
steem_instance.get_account('cadawg')['sbd_balance']

If you get a number that is not 0/error, it is working and all is well!
Thanks,
~ @cadawg

You're my hero ! ;-)

steem_instance = Steem()
steem_instance.get_account('cadawg')['sbd_balance']
'12.565 SBD'

I read "Conor Howland, and I am a 16 year old web developer & programmer from the uk."

16 years old ! You guys don't even realise the luck you have. I got my first computer at 17 (it was 1987), a several-years old, second hand Sinclair ZX81 with a 64 KB (that is kilobytes) RAM extension ... It was extremely unstable, it would reboot at random due to overheating probably ... I had to wait till 1992 to even touch another computer again (after arriving in France on a scholarship) ...

Yeah, I think I got my first PC when I was around 8-9 (2009/10), and that had 4GB ram and a low spec AMD processor (marked as a mobile processor). I am certainly very lucky! Thanks & I'm glad we could solve this problem.
~ @cadawg

Thank you for your help !

@cadawg, I like your contribution to open source project, so I upvote to support you.

Thank you so much, it means a lot!

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • This contribution is considered trivial and not technical enough. simple installation, will not be accepted.
    You can contact us on Discord.
    [utopian-moderator]

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63744.49
ETH 2639.10
USDT 1.00
SBD 2.77