In this post I will show you how to install steem-python
, the official STEEM library for Python
! I've mainly written this post as I spent a lot of time trying to install steem-python
using other tutorials, but it was never as straightforward as they made it seem. Especially trying to install it on Windows is a complete hassle, as I will explain below.
Step 1 - Installing Ubuntu 16.04
Unfortunately installing steem-python
on Windows is incredibly hard because it requires Python 3.6
. The problem with this is that steem-python
requires another package called scrypt
, and this package is only available in a pre-compiled form for Windows when using Python 3.5
or below. This means that scrypt
is near impossible to install on Windows when using Python 3.6
, but don't worry, there is a solution to this problem! You can either download a virtual machine like VMware and install Ubuntu 16.04 on it (like I have done for the sake of this tutorial) or purchase one of the many available Ubuntu servers out there, like DigitalOcean's droplet. There are plenty of tutorials online on how to install Ubuntu on a virtual machine, or how to get an Ubuntu server up and running, so I won't be going over that here.
Step 2 - Installing Python 3.6
Ubuntu 16.04 comes with Python 2.7
and Python 3.5
already installed, but not with Python 3.6
. There are multiple ways of installing Python 3.6
, but in my opinion a very convenient way is by installing Anaconda
. To do this you must do the following:
- Open a terminal with
CTRL + ALT + T
and navigate to the/tmp
folder
$ cd /tmp
- Find the latest version of
Anaconda
on their download page and usecurl
(installcurl
withsudo apt-get install curl
if needed) to download it
$ curl -O https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
- Once it is downloaded run the script (just keep pressing
ENTER
and typeyes
) to installAnaconda
(this could take a while)
$ bash Anaconda3-5.0.1-Linux-x86_64.sh
Once it has finished installing it will ask the following:
Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/amos/.bashrc ? [yes|no]
Make sure you typeyes
, this makes it possible to use theconda
command to see ifAnaconda
was installed correctly - Source your
~/.bashrc
file and make sureAnaconda
was installed correctly
$ source ~/.bashrc
$ conda --version
If this shows the version then it was installed correctly, otherwise follow step 5. - (Optional) if you didn't add the
Anaconda3
install location toPATH
in step 3, or something else went wrong, then do the following:
$ nano ~/.bashrc
then addexport PATH="/home/user/anaconda3/bin:$PATH"
(where user is your username) to the end of the file, press^X
(CTRL + X) to save the changes and source~./bashrc
again.
Congratulations, typing python --version
should now show Python 3.6.3 :: Anaconda, Inc
!
Step 3 - Installing steem-python
- Before we install
steem-python
we need to first install an Ubuntu package that is needed by thePython
packagescrypt
$ sudo apt-get install libssl-dev
- Once this is installed you can simply install
steem-python
usingpip
$ pip install -U steem
- Type
python
in your terminal to enter thePython
interpreter and see ifsteem-python
was installed correctly by doing the following
If you see something like the above image then you have installed steem-python
correctly!
Step 4 - Fixing steempy
CLI
If you try and import your account via the steempy
CLI for example, you will see the following error:
Thankfully this is an easy fix. We simply need to edit steem-python
's METADATA
file and change the following line
Requires-Dist: toml (==0.9.3.1)
to
Requires-Dist: toml (==0.9.3)
You can open the METADATA
file in an editor with the following command
$ nano /home/user/anaconda3/lib/python3.6/site-packages/steem-0.18.103.dist-info/METADATA
where user
is once again your username.
Once you have changed that line everything should be working! Congratulations! When you try to import your account now you should see the following:
Step 5 - Create!
Now you've installed steem-python
correctly, the next step is creating any program you want! An example of code I could've used to post this post on steemit (inception) can be seen below:
Read more about the library here!
Posted on Utopian.io - Rewarding Open Source Contributors
Well you should change your tutorial, right now if you follow it you get an error as https://steemd.steemit.com does not exist anymore, now it must be changed to https://api.steemit.com, here is a screen capture of how to do it easily, editing the file "steemd.py" in the same directory where the CLI from step 4 is.
Afterwards it works ok and you don't need to specify the correct node.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
It seems that it's already been fixed. I downloaded the package in the past few days and I just checked the file; It's already https://api.steemit.com.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Well I did this just three days ago and it was not fixed, maybe the steem python library version in the tutorial is not the last one and I did download that one.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Fair enough, maybe they only just updated it a day or two ago and you were unlucky enough to have downloaded it three days ago. Haha
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
it is really amazing. May I ask After we go through all the tutorials what we can do on steemit? Any interesting things we can achieve?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This is really cool and informative, but I believe Ubuntu does come with Python 3.6.3 now. I didnt have to deal with any Python updates on my fresh instalation (about a week ago) and my Python runs on 3.6.3.
Thanks for your contribution!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
The latest LTS version of Ubuntu (16.04) doesn't come with
Python 3.6
(I installed it today and tested everything on a virtual machine). The actual latest verson of Ubuntu (17.10), of which the download is currently discouraged, does come withPython 3.6
, but it isn't the LTS version, so when getting a server (like a droplet) you will more than likely have Ubuntu 16.04 installed.Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I see, I do work on 17.10 which explains a lot. Didn't even know steem API was such a pain in the ass, this tutorial is even more needed than I thought! Great work!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @amosbastian I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Anyone using steem-python over Tor? Connecting over Tor with python is easy, figured I'd see if anyone has been doing so with steem-python.
Looking quickly at the code it seems that the code to change may be in HttpClient either in /steembase/ or HttpClient in /dist/steam-1.0.2....
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi, amosbastian.
Excellent Tutorial ..! I'm following it step by step.
I have a problem in Step 3.3 when I run the s.get_account ('rcuriel') instruction python enters a loop showing the following message ....
WARNING:urllib3.connectionpool:Retrying (Retry(total=19, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb665594c>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /
...then I break it with Ctrl+"C"
Important, my operating system is Ubuntu Bionic Beaver (development branch)
could you help me..?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey, if you want you can contact me on Discord at Amos#4622, will be easier to help you out that way!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hello again.
Try to communicate with you via Discord I did not know how to do it, I'm a novice.
looking on the internet I found this solution ...
steempy set nodes https://api.steemit.com
and it worked.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Your contribution cannot be approved because it does not follow the Utopian Rules, and is considered as plagiarism. Plagiarism is not allowed on Utopian, and posts that engage in plagiarism will be flagged and hidden forever.
You have copy pasted from here. https://github.com/amosbastian/steem-python-tutorial
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for the contribution. It has been approved.
apologies for the earlier. :)
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi, thanks for this tutorial! But I have some issues; I followed the tutorial step by step (digital ocean Ubuntu 16 droplet using the newest Anaconda3-5.1.0), but I always get error messages during the installation:
Thanks for your help!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey! It would be easier for me to help out via Discord or something, so if you are still in need of help don't hesitate to contact me at Amos#4622!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Cool, thanks! I will write you when I get home today
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@amosbastian thanks for the guide, couldn't have done it without you. Maybe you could help people on steemit instead of discord, would kill 2 birds with one stone! lol Then others could see what the error and solution is?? I posted how I got mine to work in case someone else runs into my same error. Is is there a newer updated steempy I can pip install?? In the future maybe you should ask each person to post their error and then you post the solution. In the long run if devs do more of that it will drive them to steemit and then your coins will go up too!
Just because it is easier to help people on discord does not mean it is better for us or STEEM!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
YOU ARE A LIFESAVER! i've tried installing on windows 10 for over 8 hours and i failed.
there was a problem with connection tho, so i did this.
nodes=['https://api.steemit.com']
from steem import Steem
s = Steem(nodes)
anyways you're amazing 👍
i cant tell you how happy i am!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Well, now I have the same problem, but with step 4. I try
steempy importaccount gregario
asks for password, and then a long chain of error messages like the ones a had before. But now the fix
nodes=['https://api.steemit.com']
does not seem to apply, since here we are sending linux commands, while this is a python command.
I would very much appreciate any suggestions or comments.
Thanks again for these great insights.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Exactly what I needed! Thanks @amosbastian for the great, great instructions. And thanks to @roundbeargames for this clever fix.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
'$ sudo apt-get install libssl-dev'
This literrally saved my life.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Haha, great!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I do not understand this at all ..
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
What can I help you with?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Help me to grow faster
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit