Some tips from a frustrating day getting Steem Python to work on my Windows PC

Words
324
Reading
2 min
Listen
Play
9y

The good news is that I finally got it to work, so now I can start experimenting with making cool things. Unfortunately it took a lot longer than I had planned! Here are some tips to help you save time if you want to do the same thing:

First up, careful about working through tutorials now well out of date.

Not to be confused with what is now called piston, the official python steem library is this:

https://github.com/steemit/steem-python

With documentation: http://steem.readthedocs.io/en/latest/steem.html

Take 1: Compiling in Windows

If you want to pip install it from a Windows PC, it's not exactly easy.

I'd read a recent post that suggested installing Visual Studio Community to get it to work on windows (https://steemit.com/tutorials/@cryptoriddler/installing-steem-python-under-windows-10).

Download link: https://www.visualstudio.com/vs/community/.

With all the various options this ended up a 5.5gb+ install for me. Even after all of this I kept getting asked for a 'vcvarsall.bat' file. From https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/:

When you see “unable to find vcvarsall.bat”, it means you’re installing a package that has an extension module, but only the source code. “vcvarsall.bat” is part of the compiler in Visual Studio that is necessary to compile the module.

I went back, made sure I installed the 'Python development workload' option but it just couldn't get it to work.

Take 2: The Wheel

You can download a wheel file, available here https://pypi.python.org/pypi/steem which should let you use the steem-python without having to compile it yourself.

Then I installed wheel with:

python -m pip install wheel

Then I followed the instructions from the top answer here https://stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file

Tip: Do not change the filename of the wheel file, it's important

Finally, some code to try out once you get this working

This is a good example of some code to test everything works correctly:
https://steemit.com/python-steem/@felixxx/python-steem-example-your-curation-highscore

You can rewrite the line:

steem = Steem(node="wss://node.steem.ws") #temporary fix (usually: wss://this.piston.rocks )

to

steem = Steem()



You'll probably get an error about winrandom, one fix has been written by cryptoriddler@cryptoriddler here: https://steemit.com/tutorials/@cryptoriddler/installing-steem-python-under-windows-10

This all worked for me in the end. Hurray!

children-593313_1280.jpg

Image Source: Pixabay under CC0 Public Domain licence

Some tips from a frustrating day getting Steem Python to work on my... | Ecency