Building and Running a OpenMaple for Python Application
Packages
Environment
The OpenMaple for Python implementation is provided in the maple Python package.
This package may be used from a Python session or from inside Maple, using the Python package or a Python Code Edit Region.
When launched from a Python session, OpenMaple for Python requires some environment settings.
The environment variable MAPLE must be set to the value <MAPLEDIR>, where <MAPLEDIR> is the base directory of the Maple installation. This directory may be queried Maple using kernelopts( mapledir ).
native library. This native library provides the link between Maple and Python. The maple package automatically loads the required library; however, it needs to be told where to find this library.
By default, the native library is installed in the Maple binary directory. To determine this location, call kernelopts( bindir ).
The directory that Maple is installed in can be found by calling kernelopts( mapledir ).
kernelopts( mapledir );
C:\Program Files\Maple 2023
In the following sections we will refer to this directory as <MAPLEDIR>. Different platforms and installation locations will effect this directory, so you should call kernelopts( mapledir ) to determine the correct location on your machine.
kernelopts( bindir );
C:\Program Files\Maple 2023\bin.X86_64_WINDOWS
Different platforms and installation locations will effect the directory you need to use, so you should call kernelopts( bindir ) to determine the correct location. We will refer to this directory as <BINDIR> in the following examples.
To tell the Python Virtual Machine to look in this directory, you need to add <BINDIR> to a platform specific environment variable. In addition on macOS and Linux, the MAPLE environment variable needs to be set to the value <MAPLEDIR> we defined above.
Windows
In Windows, you need to add <BINDIR> to the PATH environment variable
set PATH=%PATH%;<BINDIR>
Linux
On Linux, you need to add at least <BINDIR> to the LD_LIBRARY_PATH environment variable and set the MAPLE environment variable. For a complete list of directories to add, run getenv(LD_LIBRARY_PATH); in Maple and use that exact value.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:<BINDIR>"
export MAPLE="<MAPLEDIR>"
macOS
On macOS, you need to add at least <BINDIR> to the DYLD_LIBRARY_PATH environment variable and set the MAPLE environment variable. For a complete list of directories to add, run getenv(DYLD_LIBRARY_PATH); in Maple and use that exact value.
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:<BINDIR>"
Before beginning development of a OpenMaple for Python application, ensure that the simple example from the examples page can be executed.
See Also
OpenMaple
OpenMaple/Python/API
OpenMaple/Python/Examples
Download Help Document