Skip to main content
PyMechanical logo

PyAnsys PyPI Python GH-CI Codecov MIT Ruff pre-commit Ask DeepWiki

Overview

PyMechanical is a Python interface for Ansys Mechanical (FEA software for structural engineering), enabling automation and integration of simulation workflows from 2024 R2 and later.

PyMechanical provides two distinct modes of interaction:

  • Embedding mode — Run Mechanical directly in your Python process via the App class. Full object-model access, fast startup, ideal for Jupyter notebooks and interactive scripting.

  • Remote session mode — Launch Mechanical as a separate server process and communicate via gRPC. Process isolation, optional GUI, ideal for CI/CD, Docker, and automation.

Compatibility

  • Python: 3.12 - 3.14

  • Mechanical: 2024 R2 (v242) and later

  • Platforms: Windows, Linux

Installation

Install from PyPI:

pip install ansys-mechanical-core

For graphics support:

pip install ansys-mechanical-core[graphics]

For RPC functionality:

pip install ansys-mechanical-core[rpc]

For AI assistant integration via the Model Context Protocol (MCP):

pip install ansys-mechanical-core[mcp]

Requirements:

  • Licensed copy of Ansys Mechanical (2024 R2 or later).

  • For embedded mode: Local Mechanical installation required.

  • For remote session mode: Network access to a running Mechanical instance.

Quick start

Embedding mode:

from ansys.mechanical.core import App

app = App(globals=globals())
print(app)

# Access Mechanical objects directly
Model.AddStaticStructuralAnalysis()

Remote session mode:

from ansys.mechanical.core import launch_mechanical

mechanical = launch_mechanical()
result = mechanical.run_python_script("2+3")
print(result)  # Output: 5
mechanical.exit()

Connect to existing instance:

from ansys.mechanical.core import connect_to_mechanical

mechanical = connect_to_mechanical(port=10000)
result = mechanical.run_python_script("Model.Name")
print(result)

Troubleshooting

  • Connection refused: Ensure Mechanical is running and the port is accessible.

  • License error: Verify your Ansys license is properly configured.

  • Import error: Check that ansys-pythonnet is installed (not pythonnet).

  • Linux embedding: Use mechanical-env to run Python scripts for embedded mode.

Documentation and support

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansys_mechanical_core-0.13.1.tar.gz (105.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ansys_mechanical_core-0.13.1-py3-none-any.whl (162.3 kB view details)

Uploaded Python 3

File details

Details for the file ansys_mechanical_core-0.13.1.tar.gz.

File metadata

  • Download URL: ansys_mechanical_core-0.13.1.tar.gz
  • Upload date:
  • Size: 105.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ansys_mechanical_core-0.13.1.tar.gz
Algorithm Hash digest
SHA256 6db0b82b4fdb26b4d8d75cfb11e25bdc5d32beae168c027dd0a14b401302b2ef
MD5 8a8f6cd08744be0ccc4f6fc8e104088f
BLAKE2b-256 d194188a7c0492302f4cfe2cde47f63f6f88fc61794232b19750639fee587ef5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_mechanical_core-0.13.1.tar.gz:

Publisher: ci_cd.yml on ansys/pymechanical

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ansys_mechanical_core-0.13.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ansys_mechanical_core-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 678965a0abbd235532da1e2e497bee7bd7a7216ce0fe98b3d4787f896d9d0c87
MD5 cc8182e0c3dbfd84daf3f789f4c567ab
BLAKE2b-256 6d036ec0abe2c667a8557c880c37ca67d6c558e2f17e106ac21a469d008559b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_mechanical_core-0.13.1-py3-none-any.whl:

Publisher: ci_cd.yml on ansys/pymechanical

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page