The stand-alone Metashape Python module allows to integrate Metashape functionality to the custom scripts without a need of full application installation.
Installation
First, ensure that you have Python 3.5, 3.6, 3.7, 3.8, 3.9, 3.10 or 3.11 installed on your system. After that download the .whl package from the following page:
Downloads - https://www.agisoft.com/downloads/installer/
Then install Metashape module as a regular wheel package. The procedure may be slightly different depending on the OS used:
on Windows (64-bit)
python3.exe -m pip install Metashape-2.1.0-cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl
on Linux
python3 -m pip install Metashape-2.1.0-cp37.cp38.cp39.cp310.cp311-abi3-linux_x86_64.whl
on macOS
python3 -m pip install Metashape-2.1.0-cp37.cp38.cp39.cp310.cp311-abi3-macosx_11_0_universal2.macosx_10_13_x86_64.whl
Activation
After installing stand-alone module, make sure that Metashape Pro application is activated on the same computer, where the module is supposed to be used. Alternatively, use the following command in Python IDLE console for the product activation, using your license key as an argument instead of the mock key as in the example below:
Metashape.license.activate("AAAAA-BBBBB-CCCCC-DDDDD-EEEEE")
To deactivate the license, use following command (no license key input required for deactivation):
Metashape.license.deactivate()
Offline activation
In order to activate Metashape Python module in offline mode, an activation request should be created using the following approach, note that you need also to have the activation parameters file (*.actparam) pre-generated from https://activate.agisoft.com/activate-offline page using another computer with Internet access:
### On the computer without Internet access, generate activation request (*.actreq) as follows using pre-generated (*.actparam) file:
with open("metashape.actparam", "r") as file: activation_params = file.read() activation_request = Metashape.license.activateOffline(activation_params) with open("metashape.actreq", "w") as file: file.write(activation_request)
### Transfer activation request to a computer with Internet access, open offline activation page and generate activation response (*.actresp).
### Transfer activation response back to the computer without Internet access, and install it as follows:
with open("metashape.actresp", "r") as file: activation_response = file.read() Metashape.license.install(activation_response)