DEV Community

Supernova
Supernova

Posted on • Updated on

Step-by-Step Guide for Beginners: How to Set Up the Soroban Python SDK on Windows

Setting up the Stellar Python SDK on Windows involves several steps, including installing Python, setting up a virtual environment, and installing the SDK. Here are the detailed steps:

Install Python:
Go to the Python website (https://www.python.org/downloads/windows/) and download the latest version of Python for Windows.
Run the installer and follow the instructions to install Python on your computer.
Install Git:
Go to the Git website (https://git-scm.com/download/win) and download the latest version of Git for Windows.
Run the installer and follow the instructions to install Git on your computer.
Open Command Prompt:
Press the Windows key + R, then type cmd and press Enter.
Alternatively, open the Start menu, type Command Prompt, and click on the Command Prompt app.

Install virtualenv
Enter fullscreen mode Exit fullscreen mode

In the Command Prompt, type the following command and press Enter:
Python.org
Python Releases for Windows
The official home of the Python Programming Language
Image

pip install virtualenv
Enter fullscreen mode Exit fullscreen mode

Create a virtual environment:
Navigate to the directory where you want to create the virtual environment. For example, if you want to create it in the Documents folder, type the following command and press Enter:
cd Documents
Create the virtual environment by typing the following command and pressing Enter:

virtualenv stellar_env
Enter fullscreen mode Exit fullscreen mode

This will create a new directory called "stellar_env" that contains the virtual environment.
Activate the virtual environment:
Type the following command and press Enter:

stellar_env\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

You should see the name of the virtual environment appear in parentheses in the Command Prompt.
Install the Stellar Python SDK:
Type the following command and press Enter:

pip install stellar-sdk
Enter fullscreen mode Exit fullscreen mode

This will install the SDK and any necessary dependencies.
Test the installation:
Type the following command and press Enter:
python
This will open the Python interpreter.
Type the following commands and press Enter after each one:

from stellar_sdk import Server
server = Server("https://horizon-testnet.stellar.org/%22)
print(server.fetch_base_fee())
Enter fullscreen mode Exit fullscreen mode

You should see the current base fee on the Stellar network printed to the screen.
Congratulations! You have successfully set up the Stellar Python SDK on Windows.

Top comments (0)