The AMPS Python client is published to the Python Package Index as amps-python-client
. You can use pip
to install the client directly from the repository using a command such as the following:
The AMPS Python client is available as a download from the 60East Technologies website, https://www.crankuptheamps.com/develop/. Download the client from the site, then extract it.
The client source files are in the directory where you unpacked the files. By default, this is amps-python-client-<version>
, where <version>
is the current version of the python client (such as amps-python-client-4.3.1.0
).
60East provides a prebuilt .whl
file for x64 Linux distributions using Python 2.7 or 3.4 and later.
To install the .whl
using the command line:
You will need permission to update the Python distribution on the system you are installing on.
Open a command prompt.
Run the following command, substituting the appropriate path to the release wheel that you want to install:
If this command reports a permission error, you do not have permission to update the Python distribution. Run the command as a different user, or use sudo
to run the command as root
.
60East provides a prebuilt .whl
file for 64-bit Windows operating systems using Python 2.7 or 3.4 and later. Your Python distribution may include a more fully-featured package manager to assist with installing .whl
files.
To install the .whl
using the command line:
You will need permission to update the Python distribution on the system you are installing on.
Make sure that your Python distribution includes setuptools.
Open a command prompt.
Make sure that the directory that contains python is in your path.
Run the following command, substituting the appropriate path to the release wheel that you want to install:
If this command reports a permission error, you do not have permission to update the Python distribution. Run the command prompt from a different user, or start the command prompt with Run as Administrator.
The main AMPS Python client distribution includes the full source to the client. For most installations, you build the client with your Python distribution before using it. The process for building the client differs slightly depending on whether you are building the client for Linux or for Windows.
Follow these steps to build the Linux version of the client:
The Python client includes all necessary C++ client sources. If you are using a different version of the C++ client than the one included with the Python client, set the AMPS_CPP_DIR
environment variable to the location of the AMPS C++ client source.
Run python setup.py build
from the AMPS Python client directory to build the client.
This script uses the Python distutils
to build the library, which makes it easy to build the library correctly and install the library into your Python distribution. To see the options available in your environment, run python setup.py --help
.
The module must be built with the same C++ compiler used to build python on your system. The setup.py
script and distutils
package will generally ensure this unless you have added a different compiler to your PATH
. If you typically use a different C++ compiler, remove the path to that compiler before running setup.py
.
The script builds the module to a path in the build
directory. The exact path depends on the version of Python you are building with.
Add the build directory path to the PYTHONPATH environment variable. For example:
$ export PYTHONPATH=/home/AMPSdev/amps-python-client/build/lib.linux-x86_64-2.7:$PYTHONPATH
Test that the module loads correctly:
$ python -c "import AMPS"
Optionally, install the module to your local python installation. While this is not required, doing this makes the AMPS module available for all of the programs that use this installation of python:
sudo python setup.py install
Follow these steps to build the Windows version of the client:
Use the Visual Studio Command Prompt shortcut to start a command prompt window for the type of module you want to build. For example, to build a 32-bit module, you use the command prompt for x86 builds.
Add the Python directory (the location of the python.exe
interpreter) to your PATH
.
The platform of the python installation must match the target platform for the python module. If you want to build a 64-bit module, your PATH must include a 64-bit python installation. If you want to build a 32-bit module, your PATH must include a 32-bit python installation. The build process uses whatever python.exe is found first when searching the PATH. So, to build both 32-bit and 64-bit versions, you must build them separately, and change your PATH between builds.
Run python setup.py build
from the AMPS Python client directory to build the client.
This script uses the Python distutils
to build the library, which makes it easy to build the library correctly and install the library into your Python distribution. To see the options available in your environment, run python setup.py --help
.
The script builds the module to a path in the build
directory. The exact path depends on the version of Python you are building with.
Add the build directory path to the PYTHONPATH environment variable. For example:
> set PYTHONPATH="C:\Users\AMPSdev\amps-python-client\build\lib.linux-x86_64-2.7;%PYTHONPATH%"
Test that the module loads correctly:
> python -c "import AMPS"
Optionally, install the module to your local python installation.While this is not required, doing this makes the AMPS module available for all of the programs that use this installation of python:
> python setup.py install