Installing the Steem python library under windows.

in #python7 years ago

So...first content post! One of my hobbies is writing fun things in Python and I know Steem has an API, so I wanted to start messing with that as soon as possible. I thought I'd share how to set it up so if anyone else wants to play with it they can.

I'm using win7 but it should be more or less the same for any flavor of windows.

I'm also going to assume you've already got python installed (I'm using Python 3.5.2). If not, you might want to look into something like Anaconda, it will make life easier. Maybe I'll write a post about installing python later on. For now though, onward...

Packages in python are often installed using pip, which will take care of working out any package dependencies for us, and automatically installing them as well, but there's an extra step involved for the steem library because it needs ujson, which has to be compiled. It is possible to compile it on a windows machine, but unless you want to mess around with setting up a compiler, it's probably just easier to use a precompiled binary. Go here and grab the version for your python. So for instance, in my case, it's ujson‑1.35‑cp35‑cp35m‑win_amd64.whl because I'm on python 3.5 (64 bit). Once you've got your ujson package downloaded, open up a command prompt and type:

pip install ujson‑1.35‑cp35‑cp35m‑win_amd64.whl

Of course, replace the ujson filename with the path and name of the version you downloaded.

That should install ujson for you. Once that's done, we can just let pip install the rest of the dependencies for us. Type:

pip install steem

Once that's done you can easily test it by opening an interactive python interpreter by just typing python. Then:

 from steem import Steem
 s = Steem()
 s.get_account('trentie')['sbd_balance']

Yes, I'm poor. Hopefully posts like these will fix that. :D Anyway, hopefully this will get you started on messing with Steem and python. I think I might write a series of articles on writing bots for popular messaging systems too, if there's any interest.

Sort:  

@trentie thanks for sharing...I am glad I came accross your post.
I have installed Anaconda under the command prompt I can't seem to:
pip install steem

Or how do I use Anaconda to do this...

Maybe you can give me a hand.

I am working with a Jupyter Notebook, on top of an Anaconda installation, in windows 7.

Seems like I was able to install ujson . But

pip install steem

gives this error message

scrypt-1.2.0/lib/crypto\crypto_scrypt.h(33): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

----------------------------------------

Failed building wheel for scrypt
Command "C:\Users\Julio\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Julio\AppData\Local\Temp\pip-build-uwbpky2q\scrypt\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\Julio\AppData\Local\Temp\pip-pdggx6q3-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Julio\AppData\Local\Temp\pip-build-uwbpky2q\scrypt\

same

hey im on windows 10 getting same error

Same problem here...

you need ssl dependencies, in linux is solved with this sudo apt-get install libssl-dev, find a workaround for windows, tell visual studio where it can find it....

I have also same problem with windows ( crypt-1.2.0/lib/crypto\crypto_scrypt.h(33): fatal error C1083: Cannot open include file: 'unistd.h': No )