...
This page
...
Table of Contents
Table of Contents | ||||
---|---|---|---|---|
|
Introduction
The Squirro Toolbox package for Python replaces the operation system specific versions for Windows, Mac or Linux. This Squirro Toolbox is installed into an existing Python environment, which can then make use of all the default Python operations, such as pip install
for package installation.
Download
Download the Squirro Toolbox from the /wiki/spaces/DOWN/overview#Downloads-SquirroToolbox(CommandLineTools) (license required). Select the version for Python. The download file will have a name of the form squirro.toolbox-VERSION.PYTHON-none-any.whl
.
Set up Python
Make sure you have a Python environment set up with Python 3.6 or higher.
It is recommended, but not required, to work with a virtual environment (virtualenv
). Covering the details of setting up and working with virtualenv is beyond the scope of this guide. A suggested read is the Virtualenv documentation.
Installation
Install the downloaded whl
file using pip:
Code Block |
---|
$ pip install squirro.toolbox-VERSION.PYTHON-none-any.whl |
Upgrade
If you have a Squirro Toolbox installed and would like to updated to a new version use
Code Block |
---|
pip install --upgrade squirro.toolbox-$NEW_VERSION.PYTHON-none-any.whl |
Dependencies (Troubleshooting)
Especially on Windows, you may encounter the following error when installing:
Code Block | ||
---|---|---|
| ||
…
copying Levenshtein\_levenshtein.h -> build\lib.win32-2.7\Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
----------------------------------------
Command … failed with error code 1 in …\python-levenshtein\ |
This is because this dependency is a binary package that has to be compiled. Christoph Golke maintains a great resource where he provides pre-compiled packages, so that you do not have to go through the hassle of setting up the right Python compilation environment locally. For any dependency that fails (python-levenshtein in this example) follow this process:
- Go to Unofficial Windows Binaries for Python Extension Packages
- Find the package you are looking for (python-levenshtein in the example)
- Download the package with the correct architecture (win32 or amd64, depending on your Python installation) and python version (cp27 for Python 2.7 or cp36 for Python 3.6, depending on your Python environment) - this will download a
whl
file - Install the downloaded file with pip:
pip install ….whl
- Try the Squirro Toolbox installation again (see above)
Usage
The Squirro toolbox contains a number of command line applications, that are used to work with a Squirro cluster. For example the Data Loader, which is used to index data in Squirro.
With a command line, you can run the following command:
Code Block | ||
---|---|---|
| ||
squirro_data_load --version |
This command runs the executable squirro_data_load with the argument --version
. If the toolbox is correctly installed, this outputs the version of the toolbox.
To get an overview of the command and what it is capable of, use the --help
argument:
Code Block | ||
---|---|---|
| ||
squirro_data_load --help |
This help message defines how the executable is to be used. Arguments presented in square brackets are optional, where as arguments presented without the square brackets are mandatory.
For example:
Code Block | ||
---|---|---|
| ||
[--verbose] :: Optional parameter
--token TOKEN :: Mandatory parameter requiring user input |
The executable will not run without all mandatory arguments supplied, displaying an error message like "squirro_data_load: error: too few arguments". Arguments presented with a second word in block capitals indicates that a user input is required for that argument, in the case above, the user API token is required. An example giving that token:
...
language | bash |
---|
...
can now be found at Install In a Python Environment on the Squirro Docs site.