Getting steem-python to run on Windows with the latest python version

in hive-151113 •  8 hours ago 

This weekend, I was helping @cmp2020 with installing steem-python in Windows. We started by following these instructions from @moecki, but we ran into problems with "pip" and the scrypt dependency, and I couldn't find a way to work around them.

So we moved on to "plan B" and worked straight from github, where we did eventually manage to get it working. A side effect of adopting our "Plan B" is that steem-python also seems to be functioning with the latest version of python, whereas the previous tutorial reported that 3.9 was the max compatible version.

Here's the process (with the caveat that we didn't start with clean systems, so there may be other prerequisites that I'm unaware of.):

  1. Install Python. I used version 3.13.2.
  2. Install OpenSSL (I'm not 100% sure that this is needed, but based on the Tutorial from @moecki, I believe so. It was already installed on my computer, so I can't be 100% sure.)
  3. Create a virtual environment in a Windows directory of your choosing:
    example: python3 -m venv virtSteemPy3.13.2 # !!! Use the appropriate path for your desired python version.
  4. Activate the virtual environment
    example: virtSteemPy3.13.2\Scripts\activate (you can deactivate later as virtSteemPy3.13.2\Scripts\deactivate)
  5. Inside the virtual environment, clone my fork of the Steem repo (which has some minor changes from Steemit's)
    example: git clone https://github.com/remlaps/steem-python.git
  6. Switch to the modified branch
    example:
    • cd steem-python
    • git checkout myWindowsBranch
  7. Build and install
    example:
    • pip install build
    • python -m build
    • pip install .

And that should be it (I think). For the record, here are the two changes that I made from Steemit's master branch to the myWindowsBranch:

(steempy13Env) > git diff master myWindowsBranch
diff --git a/setup.py b/setup.py
index d7877ab..7f42766 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ REQUIRED = [
     'prettytable',
     'pycrypto>=1.9.1',
     'pylibscrypt>=1.6.1',
-    'scrypt>=0.8.0',
+    'pycryptodome',
     'toolz',
     'ujson',
     'urllib3',
diff --git a/steem/steemd.py b/steem/steemd.py
index 6ae89bc..7063100 100644
--- a/steem/steemd.py
+++ b/steem/steemd.py
@@ -51,7 +51,7 @@ class Steemd(HttpClient):
        """

     def __init__(self, nodes=None, **kwargs):
-        if not nodes:
+        if not isinstance(nodes, (list, str )):
             nodes = get_config_node_list() or ['https://api.steemit.com']

         super(Steemd, self).__init__(nodes, **kwargs)

There's also a pull request on Steemit's repo (from someone else) that has a more comprehensive set of changes for compatibility with newer python versions. It seems that it's pending review and approval from Steemit, so the steps described here are (hopefully) just a stopgap until Steemit's repo gets updated (and published in PyPi(?)?)

In addition to burning 25% of rewards, this post has 15% beneficiaries to @moecki and @cmp2020 in gratitude, since it's building on some of their work.


Thank you for your time and attention.

As a general rule, I up-vote comments that demonstrate "proof of reading".




Steve Palmer is an IT professional with three decades of professional experience in data communications and information systems. He holds a bachelor's degree in mathematics, a master's degree in computer science, and a master's degree in information systems and technology management. He has been awarded 3 US patents.


image.png

Pixabay license, source

Reminder


Visit the /promoted page and #burnsteem25 to support the inflation-fighters who are helping to enable decentralized regulation of Steem token supply growth.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

I am very surprised that there is a PR. I wonder who the author is. He has not yet appeared in connection with Steem. I'll ask in the witness channel and take a closer look at his changes. His PR also contains some old commits...