Impact Acquire SDK Python
|
As supporting all the various distributions and versions of Python out there with a binary interface is almost impossible, the Impact Acquire Python API needs to be compiled for a specific version of Python it shall be used with. Because of that what is shipped at the moment is source code that has been generated using SWIG which before using it requires a compilation operation.
The compilation requires a compiler that matches the version of Python that shall be used. E.g. to compile Impact Acquire for Python 3.3 on Windows systems, Visual Studio 2010 is required. Additional information about the compiler that works for a particular Python version on a particular platform can be found online. See e.g.
Impact Acquire 3.0.1
, the support for Python 2 has been dropped. It is highly recommended to migrate to Python 3.x!When installing the Impact Acquire Python API on a target system all files needed for building the actual extension module can be found in $MVIMPACT_ACQUIRE_DIR/LanguageBindings/Python or on Windows systems in %MVIMPACT_ACQUIRE_DIR%\LanguageBindings\Python.
During the compilation process the following Python packages will be used:
Impact Acquire version | required Python package |
---|---|
<= 2.50.1 | distutils |
>= 3.0.1 | setuptools, build |
On Windows systems running %MVIMPACT_ACQUIRE_DIR%\LanguageBindings\Python\compileWrapperCode.bat will build and install the Python API in the site-packages sub-folder of your Python installation, provided a matching compiler could be found.
Path
variable. If this is not the case, please append the directory path containing the python.exe
to Path
variable either permanently using the System's environment variable dialog or temporarily within the command shell where the script will be called e.g.: set Path=%Path%;C:\Python310 compileWrapperCode.bat
Impact Acquire <= 2.50.1
, the distutils
package coming with Python 3.6 is only capable of finding Visual Studio 2015 (i.e. MSVC 14.0
). For Visual Studio 2017 or later (i.e. MSVC 14.1
or above), please make sure to compile 'Impact Acquire for Python' for Python 3.7 or greater!Before building the Impact Acquire Python package for the Anaconda Python distribution, append the Anaconda installation path (by default: C:\Users\%userName%\Anaconda3
for Python 3.x) in the system Path
variable.
Follow the instruction above to build and install the Impact Acquire Python API. The Impact Acquire package will be installed under the site-packages
directory of the Anaconda path specified in the system Path
variable, which is by default (for Python 3.x) C:\Users\%userName%\Anaconda3\Lib\site-packages
For Impact Acquire <= 2.50.1: in order for Anaconda Python to be able to import the Impact Acquire package, the installed package mvIMPACT-xxx-win-xxx.egg has to be split into two directories:
site-packages\mvIMPACT-xxx-win-xxx.egg\EGG-INFO
→ site-packages\mvIMPACT-xxx-win-xxx.egg-info
site-packages\mvIMPACT-xxx-win-xxx.egg\mvIMPACT
→ site-packages\mvIMPACT
On Linux systems running $MVIMPACT_ACQUIRE_DIR/LanguageBindings/Python/compileWrapperCode.sh can be used to build and install the Python API in the site-packages sub-folder of your Python installation, provided a matching compiler could be found.
The recommended way to call the installation script is:
./compileWrapperCode.sh
It will request root privileges to install the wrapper to the site-packages directory during the process.
setuptools
and build
) is not possible on systems that manage Python modules via the system package manager (for example Debian, Ubuntu, Arch Linux, and NixOS). If the script fails due to these missing modules, most likely you need to install the modules manually beforehand. Refer to the table above for the required modules.In Anaconda environment, follow the instruction above to build and install the Impact Acquire Python API. The Impact Acquire package will be installed under the site-packages
directory of the Anaconda installation path, which is by default (for Python 3.x) $HOME/anaconda3/lib/python3.X/site-packages
(where X
is the Python minor version).
For Impact Acquire <= 2.50.1: in order for Anaconda Python to be able to import the Impact Acquire package, the installed package mvIMPACT-*.egg has to be split into two directories:
$ cd ~/anaconda3/lib/python*/site-packages $ cp -r mvIMPACT*.egg/mvIMPACT . $ cp -r mvIMPACT*.egg/EGG-INFO . && mv EGG-INFO "$(ls | grep mv*.egg)-info"