.. _installing:

Installing the library
######################


#. Download an archive matching your OS and Python version from the (`release page <https://pystim.dev/pystim-download>`_).
#. Extract the archive to a location of your choice 
#. Set the environment as described below.

.. note::
    Note that the Python installation on the target OS must include Python shared libraries. PyStim utilizes these shared libraries to embed the Python interpreter.


The environment setup file is located in the extracted directory and is named `scripts`.

.. code-block:: bash

    export PY_STIM_INSTALL_DIR="<extracted_location>"

    # or source the environment file
    source <extracted_location>/scripts/environment.sh 

`<extracted_location>` location should include the `pystim` files (lib, system_verilog, and ect.).

Verify the installation for QuestaSim by running the following command:

.. code-block:: bash
    
    cd $PY_STIM_INSTALL_DIR/examples/hello_world
    source ../../scripts/environment.sh
    ./run.sh


To enable Python to find your project's modules and files, you need to add the directory containing them to the PYTHONPATH environment variable.
Python searches these directories when looking for imports.

.. code-block:: bash
    
    export PYTHONPATH="$PYTHONPATH:<path to the yours python files>"



