Tutorial - How to install Steem Python on Windows 10/11steemCreated with Sketch.

in Steem Devlast year

Recently I was asked by @visionaer3003 if I had a tip on how to install the Steem Python library on a Windows system. Since my last installation was some time ago, I could only vaguely remember the complications this entailed and could not give a proper answer in a hurry.
Because I would like to help him anyway, and perhaps other developers would be interested, here is the tutorial for the installation.
I have set up a VM with a fresh Windows to be able to follow all the steps. Take a deep breath, take a lot of time and then you can get started.
(Please excuse the German texts in the screenshots. I noticed that too late.)

Content

  1. Installing Python
  2. Setting up a virtual environment
  3. Installing Microsoft Build Tools
  4. Installing OpenSSL
  5. Installing Steem-Python

1. Installing Python

The Steem Python library is unfortunately a bit outdated and not compatible with all Python versions. The latest working version is Python 3.9.

The installation package can be downloaded here: https://www.python.org/downloads/
The last installation package of version 3.9 is available here: https://www.python.org/downloads/release/python-3913/

So download the appropriate package and install it on your system with the default options:

62 install python.png

Among others, you have now installed the launcher py, which can used to start any installed Python version.
The launcher can be started either via the start menu ...

62_startmenu.png

... or via the command prompt:

62_py-test.png

2. Setting up a virtual environment

Python is now installed for the user. A script could now already be executed with py script.py.
However, before we proceed to install further modules, an intermediate step should be made.
A major advantage of using Python are virtual environments. They allow you to work with different Python versions and modules for each script without maintaining them in the global system.
Therefore, I generally recommend creating a virtual environment. You do this in the directory where the scripts created.

Open a command prompt and create a directory (e.g. steem-scripts):
mkdir steem-scripts

In this directory create the virtual environment with the name .venv:
cd steem-sripts
py -m venv .venv

If you have only one Python version, you do not need to specify the version. If you have another version use this command:
py -3.9 -m venv .venv

A subdirectory with the name .venv has now been created. The specified Python version was copied into it. The scripts are now always started with this version when the virtual environment is activated.

The virtual environment can be activated with ...
.\.venv\Scripts\activate
... and deactivated with
deactivate

However, the virtual environment should remain activated for the rest of the installation. It now looks something like this with the commands shown:

62_venv.pngDon't be confused, this was my attempt with version 3.10.

3. Installing Microsoft Build Tools

Everything is now prepared for Python, but not yet for Steem... Windows still needs a few tools to install the Steem Python library.
Please download the build tools here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

62 build tools.png

After starting the downloaded program, the Visual Studio Installer will be prepared and installed. Don't worry, the full Visual Studio will not installed here. If you already use Visual Studio on your system, you have to modify the installation.
The following options must be installed in any case:

62 build tools choice.png

Note: For me, the button is called "Modify" because I had to try several times before I found the right combination. If the installation is new, it only shows "Install".

4. Installing OpenSSL

Unfortunately, this is still not all the preparations for Steem Python on a Windows system. Your system still needs OpenSSL if it is not already installed.
Please download the package here: https://slproweb.com/products/Win32OpenSSL.html
The light package is not enough. Please take this one:

62_openssl.png

The installation can done with the standard options.

5. Installing Steem-Python

So, now the final step. You have prepared the system so far that you can install the library. However, you still need a little trick here (later).
You need a command prompt and change into the script directory (I called it steem-scripts above). If the virtual environment is no longer activated, please activate it with .\.venv\Scripts\activate.
Since we are now in the virtual environment with the right Python version, we no longer need the launcher. So we start the installation directly with:
pip3 install steem

Attention: You may receive the following error during the installation:

62_error_pycrypt.pngklicken zum Vergrößern

Don't panic: You can fix the error. The tip for this was given here. For the time of installation, definitions must be inserted into the file marked with the red box.
Open the file with the editor and insert these lines before the line with the first error mentioned in your error message (line 27 in my case):
#define intmax_t long long
#define uintmax_t unsigned long long

Now the next (successful) attempt:
pip3 install steem

Unfortunately, the crypto module included in the library is no longer up-to-date. It still includes pycrypto, which should no longer be used. We update this with
pip3 install pycryptodome

If not already done, remove the lines you just inserted in the header file.
You can test the installation with steempy. This should list all options without an error.

Done!

Congratulatoin! I have to admit, that was a big workload!
Whether it makes sense to install Steem on Windows systems is something everyone must answer for themselves. VSCode can also be run on Windows systems in the WSL so that the library can installed on the Linux system. That is not entirely uncomplicated either, but it does require fewer steps.

Overall, Steem-Python is in urgent need of renovation. I don't know if it's worth the effort, since many people prefer to work with Javascript or use beem straight away.
I think there should be a library usable for the Steem. That is why I have already made a few modifications in my library. For example, I implemented the operation claim_account.

Good luck for your next project with Steem Python. :-))

Steem Search on https://moecki.online/

My Full Node on https://api.moecki.online

My Python Pricefeed for Witnesses

Thanks for your Witness Vote

29.09.2023
Sort:  

WooW das nenne ich ja Überraschung, ich weiß nicht, was ich sagen soll, hehe es gibt eigentlich viel zu sagen aber heute nicht nur herzlichen Dank für den tollen Tutorial 🙏

 last year 

Freut mich, wenn die Überrauschung gelungen ist. Wenn es denn auch hilfreich ist, ist es natürlich noch besser. :-)
Lass dir ruhig Zeit, der Post wird ja nicht so schnell verschwinden ;-)

To be able to work with such a volume of technical information means to be a professional developer. It’s very good that you know how it works, and it’s also good that you tell other people. In a word, you share your knowledge. I have read your post twice but it is very difficult for me. I wish you success in technological progress. Thank you very much.

 last year 

Thank you.
I am happy if I can share a few tips. The post will remain there for a while, so anyone who needs help on the subject is welcome to look it up. Maybe even you someday :-)

Thank you very much for your kindness and response to my comment. I will remember your post. Have a nice day.

 last year 

Nice. I didn't know it was possible to run Steem-Python in Windows. I have always used linux VMs inside of Windows.

 last year (edited)

I use it mainly because I work with VSCode on Windows. I only found out later that I could also run it within the Windows Subsystem for Linux (WSL). Now I use it for the work with Steem and Steemit-Condenser.

I have always used linux VMs inside of Windows.

With WSL oder an extra VM (with Hyper-V or another Software)?

 last year 

With WSL oder an extra VM (with Hyper-V or another Software)?

A mix of WSL and VirtualBox.

 last year 

Ah, I also experimented with VirtualBox before I discovered WSL. :-)

 last year 

If I remember right, WSL wasn't available yet when I first started with VirtualBox and Steem. I was using that for PoW mining back before they disabled that feature (and before the disk size for a node outgrew my computers).

 last year 

WSL wasn't available yet when I first started with VirtualBox and Steem

I can imagine that. Microsoft was late in recognising the potential of integrating Linux.

PoW mining

I did notice this function in the documentation, but then didn't look into it more intensively because it was deactivated. Was it also possible to generate/produce STEEM or SP with it?

 last year 

Was it also possible to generate/produce STEEM or SP with it?

Yeah, it was possible. I brought in a few hundred SP that way. If I remember right, they had 19 slots for the primary witnesses, 1 slot for an alternate witness, and the 21st slot each round went to a proof of work miner.

Unfortunately, someone managed to hack the algorithm, and a single miner was dominating the PoW mining queue (@supercomputing and @supercomputing01-99 accounts, or something like that... see here). They tried to fix the algorithm a time or two, but kept having problems so they disabled it and went to 100% DPOS. No idea who the account owner was, but they brought in a nice rake...

Ich habe meine ersten Erfahrungen dieser Materie mit beem im Google-colab gemacht , und im Github hat HolgerN auch einen Haufen von Beispielen hinterlassen .
Und ich bin nun nicht der Typ , der alles auf anhieb kapiert , ´Rumprobieren muss ich bis es klappt und dann kann ich mir das auch für eine Weile merken , hihi , aber nur eine Weile .

 last year 

Google-colab

Ach, das ist ja cool. Das kannte ich noch gar nicht. Scheinbar ist das so ähnlich wie Jupyter-Notebook. Da kann man auch einzelne Codebeispiele unmittelbar ausführen lassen...

im Github hat HolgerN auch einen Haufen von Beispielen hinterlassen

Meinst du im Github zu beem oder die Doc-Seite? Die habe ich mir auch schon sehr interessiert angeschaut. Oder gibt es da noch eine andere Seite?

Rumprobieren mache ich besonders gern... :-) Ja, ich glaube auch, dass man sich sowar nur begrenzt merken kann, wenn man es nicht praktisch einsetzt. Ne gute Mischung zwischen "Anlernen" und "Anwenden" ist da noch am Besten...

Ja , dieses Jupyter-Konzept fand ich ziemlich hilfreich , und nochmal ja , ich schätze ich habe das meiste aus der Doku , die Du da verlinkt hast .

!invest_vote

@udabeu denkt du hast ein Vote durch @investinthefutur verdient!
@udabeu thinks you have earned a vote of @investinthefutur !