Creating a Python project - AWS SimSpace Weaver

End of support notice: On May 20, 2026, AWS will end support for AWS SimSpace Weaver. After May 20, 2026, you will no longer be able to access the SimSpace Weaver console or SimSpace Weaver resources. For more information, see AWS SimSpace Weaver end of support.

Creating a Python project

You use the create-project.bat script to create a Python project, the same way as you would to create a non-Python project. You can use the PythonBubblesSample template as the starting point for your Python project. See Create a Python project, below.

Python custom container

To run your Python-based SimSpace Weaver simulation in the AWS Cloud, you can create a custom container that includes the necessary dependencies. For more information, see Custom containers.

A Python custom container must include the following:

  • gcc

  • openssl-devel

  • bzip2-devel

  • libffi-devel

  • wget

  • tar

  • gzip

  • make

  • Python (version 3.9)

If you use the PythonBubblesSample template to create your project, you can run the create-custom-container.bat script (located in the tools folder of your project) to create a Docker image with the necessary dependencies. The script uploads the image to Amazon Elastic Container Registry (Amazon ECR).

The create-custom-container.bat script uses the following Dockerfile:

FROM public.ecr.aws/amazonlinux/amazonlinux:2 RUN yum -y install gcc openssl-devel bzip2-devel libffi-devel RUN yum -y install wget RUN yum -y install tar RUN yum -y install gzip RUN yum -y install make WORKDIR /opt RUN wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz RUN tar xzf Python-3.9.0.tgz WORKDIR /opt/Python-3.9.0 RUN ./configure --enable-optimizations RUN make altinstall COPY requirements.txt ./ RUN python3.9 -m pip install --upgrade pip RUN pip3.9 install -r requirements.txt

You can add your own dependencies to the Dockerfile:

RUN yum -y install dependency-name

The requirements.txt file contains a list of Python packages required for the PythonBubblesSample sample simulation:

Flask==2.1.1

You can add your own Python package dependencies to the requirements.txt:

package-name==version-number

The Dockerfile and requirements.txt are in the tools folder of your project.

Important

You must run create-custom-container.bat after any changes to the Dockerfile or requirements.txt.

Important

You technically don't have to use a custom container with your Python simulation, but we strongly recommend that you use a custom container. The standard Amazon Linux 2 (AL2) container that we provide doesn't have Python. Therefore, if you don't use a custom container that has Python (such as the container image created by the create-custom-container.bat script), you must include Python and the required dependencies in each app zip file that you upload to SimSpace Weaver.

Create a Python project

The following procedure is for Microsoft Windows. If you are using Windows Subsystem for Linux (WSL), use the .sh versions of the .bat scripts instead. You must complete the setup for Amazon Elastic Container Registry (Amazon ECR) to use this procedure. For more information, see Setting up with Amazon ECR in the Amazon ECR User Guide.

To create a Python project
  1. In a command prompt window, go to your SimSpace Weaver SDK folder.

    cd sdk-folder
  2. Run create-project.bat with the PythonBubblesSample template.

    .\create-project.bat --name project-name --path project-folder-parent-path --template PythonBubblesSample
  3. Go to the tools folder in your project folder. Your project-folder is project-folder-parent-path\project-name.

    cd project-folder\tools
  4. Create the custom container.

    .\create-custom-container.bat