Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: update required packages docs, updated links

To run the SmartMeshSDK sample applications directly from source code you need to have Python installed and you also need some additional Python packages. This is only necessary if you wish to modify the behavior of the sample apps. This process is also required for running the applications on systems that cannot directly run Windows executables, such as Linux. 



Python installation instructions are different for 32-bit and 64-bit versions of Windows. Please follow the appropriate set of instructions below.


Most modern OSes come with Python pre-installed. To check if you have Python installed, open a command prompt (DOS window) and type:

No Format
C:\Python27\python.exe --version

It should print out something like:

No Format
Python 2.7.8
Info

If you installed Python using Anaconda, Python will be in a different location.

Follow the appropriate instructions for your operating system:

Table of Contents
maxLevel2
minLevel2


Python Installation on Windows XP or 32-bit Windows 7

Install Python 2.7

  1. Download the latest Python 2.7 Windows Installer from http://python.org/download/.from the Python downloads site
    At the time of writing, the latest Windows Installer was python-2.7.212.msi.
  2. Double click on the installer and follow the installation steps using all default settings. 

Install PySerial

PySerial adds serial port support to Python.

  1. Download PySerial for Python 2.7 from http://sourceforge.net/projects/pyserial/files/pyserial/.
    At the time of writing, the latest version was pyserial-2.5.


    Make sure to install PySerial for Python 2.7, e.g. pyserial-2.5.win32.exe.

    Do not install PySerial for Python 3.0, e.g. pyserial-py3k-2.5.win32.exe.

  2. Double click on the installer and follow the installation steps using all default settings.

Install PyWin32

This step is optional. It's not necessary unless you want to run the Serial Mux Configurator from source. The Serial Mux Configurator can be run from its executable form. 

PyWin32 adds Windows-specific support to Python. While most applications in the SmartMeshSDK are platform independent, some like the Serial Mux Configurator have platform-specific requirements. PyWin32 provides different installers for various Python versions

  1. Download the pywin32 installer. On the pywin32 downloads page (http://sourceforge.net/projects/pywin32/files/pywin32/), find the appropriate pywin32 installer based on your Python version (2.7) and whether you are running 32-bit or 64-bit Python. At the time of this writing, the latest 32-bit build for Python 2.7 was pywin32 build 217.
  2. Double click on the installer and follow the installation steps using all default settings.


Python Installation on 64-bit Windows 7


Unless you know that you need to run the 64-bit version of Python and PySerial for some other purpose, you should run the 32-bit version. Follow the instructions above.


Install Python 2.7

  1. Download the latest Python 2.7 Windows X86-64 Installer from http://python.org/download/.Python downloads site
    At the time of writing, the latest Windows Installer was python-2.7.212.amd64.msi.
  2. Double click on the installer and follow the installation steps using all default settings. 

Install PySerial

Installing Pyserial is done differently for 64-bit Windows 7. It is a two step process:

  1. Install setuptools from http://pypi.python.org/pypi/setuptools. At the time of writing, setuptools 0.6c11 is the latest version.
    1. Go to the Installation section for Windows and download ez_setup.py from the link in the instructions there.
    2. Run the ez_setup.py file that you downloaded, by double-clicking on the script icon. This should result in the creation of a folder named Scripts in your Python folder. 
  2. Install PySerial using the easy_install.exe script from the step above. The easy_install.exe script should be in your Python folder, e.g., C:\Python27\Scripts. (This folder might be a different place if you specified a different location when you installed Python.)
    1. Open a Windows Command Prompt. Navigate to the C:\Python27\Scripts folder. (How to get to the command prompt: http://www.sevenforums.com/tutorials/947-command-prompt.html)
    2. Run easy_install.exe and supply "pyserial" as a command line argument, e.g.  easy_install.exe pyserial

Install PyWin32

This step is optional. It's not necessary unless you want to run the Serial Mux Configurator from source. The Serial Mux Configurator can be run from its executable form.

PyWin32 adds Windows-specific support to Python. While most applications in the SmartMeshSDK are platform independent, some like the Serial Mux Configurator have platform-specific requirements. PyWin32 provides different installers for various Python versions

  1. Download the pywin32 installer. On the pywin32 downloads page (http://sourceforge.net/projects/pywin32/files/pywin32/), find the appropriate pywin32 installer based on your Python version (2.7) and whether you are running 32-bit or 64-bit Python. At the time of this writing, the latest 64-bit build for Python 2.7 was pywin32 build 217.
  2. Run the installer.


Python Installation on Linux (Ubuntu)

Install Python 2.7

Python 2.7 is part of the standard Ubuntu distribution. If python is not present, you can install it with the Ubuntu package manager. 

No Format
$ sudo apt-get install python2.7 python-pip


Install PySerial

PySerial can be installed with the Ubuntu package manager. 

No Format
$ sudo apt-get install python-serial


Python Installation on Macintosh OS X

Install Python 2.7

Python 2.7 is part of the standard OS distribution. If python is not present, you can install use a package manager like macportslike MacPorts to install it

No Format
$ sudo port install python27


Install PySerial

PySerial can be obtained here. Follow the installation instructions in the /documentation/pyserial.rst file. 

Test your Installation

  1. Navigate to the /src/ directory, then to the bin/InstallTest directory
  2. Double click on InstallTest.py
  3. If your installation is complete, a Python command window will open with the following text:

    No Format
    Installation test script - Dust Networks SmartMeshSDK
    
    
    Step 1. Python version
    You are running Python 2.7.1
    PASS
    
    Step 2. PySerial installation
    PASS
    
    Press Enter to exit.
  4. Make sure all tests contain the word PASS.


Install

additional

required Python packages

Some of the SmartMeshSDK sample applications require additional Python packages to be installed. For consistency, all of the required packages are listed together even though no single application depends on all of the packages being present. In special cases, the README document may list additional requirements. 

The required packages are listed in the requirements.txt file. If you cloned or downloaded the source files from GitHub, the requirements file is found in the root directory. If you downloaded the latest full release with both source files and windows executables, the requirements file is located in the /src directory. 

You can install the packages directly from the requirements file using pip:

No Format
$ pip install -r requirements.txt
Info

The pip package manager is included in the standard Python installation since the 2.7.9 release.

The best practice is to use virtualenv to install the required SMSDK packages in a virtual environment to avoid package conflicts with other Python projects. Instructions on using virtualenv are beyond the scope of this document, but there are many good references available on the Internet.