To run PyOptiSLang, you must have access to a licensed copy of optiSLang. The first supported version of optiSLang is 2023 R1. For more information on optiSLang, see the Ansys optiSLang page on the Ansys website.
ansys-optislang-core package supports Python 3.7 through 3.10 on
Windows and Linux. Three modes of installation are available:
For either a developer or offline installation, consider using a virtual environment.
Install the latest release from PyPi with this command:
pip install ansys-optislang-core
Alternatively, install the latest PyOptiSLang GitHub package with this command:
pip install git+https://github.com/ansys/pyoptislang.git
If you plan on doing local development of PyOptiSLang with GitHub, clone and install PyOptiSLang with this code:
git clone https://github.com/ansys/pyoptislang.git cd pyoptislang pip install -e .
A developer installation allows you to edit
files locally. Any changes that you make are reflected in your setup
after restarting the Python kernel.
Using a wheelhouse can be helpful if you work for a company that restricts access to external networks. From the Releases page in the PyOptiSLang repository, you can find the wheelhouses for a particular release in its assets and download the wheelhouse corresponding to your setup.
You can then install PyOptiSLang and all of its dependencies from one single entry point that can be shared internally, which eases the security review of the PyOptiSLang package content.
For example, on Linux with Python 3.7, unzip the wheelhouse and install PyOptiSLang with code like this:
unzip PyOptiSLang-v0.1.0-wheelhouse-Linux-3.7.zip wheelhouse pip install ansys-optislang-core -f wheelhouse --no-index --upgrade --ignore-installed
If you’re on Windows with Python 3.9, unzip the wheelhouse to a wheelhouse directory and
then install using the same
pip command as in the preceding Linux code example.
Ansys software requirements#
You must have a local licensed copy of optiSLang installed or be able to connect to an already running remote instance. As mentioned earlier, the first supported optiSLang version is 2023 R1.
To verify your optiSLang installation, run this code:
from ansys.optislang.core import Optislang osl = Optislang() print(osl) osl.dispose()
If you see a response, you can start using OptiSLang as a service. For information on the PyOptiSLang interface, see User guide.