Troubleshooting Installation Issues with the Python Agent

Variations in Python environments and the release of Python you use may result in issues when you install the Python agent or when you run applications.

To start troubleshooting issues related to Python, see the following in the Python documentation first:

When you access the documentation on the Python website, you may need to select the release of Python you use from the menu in the upper-left corner of the page.

Problem

Solution

On Linux, the device-cloud package installs successfully, but the module is not found when you run the Device Cloud programs.

Check where the package installed:
pip show device-cloud

If the package is installed in the global site-packages or global dist-packages directory on Linux distributions that use the lib64 directory, such as Fedora and Linux, pip may install the files in the lib directory. Use the --target option to install it in the correct location. For example:

sudo pip install --target=/usr/lib64/python2.7/site-packages/ device-cloud

If you have multiple installations of Python installed on Windows and the Python installation directories are both in the system PATH, you may see the error ImportError: No module named device_cloud. This means that the installation location does not match the first entry in the system PATH.

If possible, uninstall the release of Python you are not using. Otherwise, ensure that the installation directory for the release of Python you want to use is listed first in the system PATH. Alternatively, you can use a virtual environment.

When you try to install the device-cloud package, the message pip: command not found appears.

If you are using Python 3, you may need to use the pip3 command to install the package. You may need to install the python3-pip package first.

When you install the device-cloud package in a virtual environment, you may see the error Failed building wheel.

Virtual environments may not have all the required packages installed. If you see this specific message, run pip install wheel to install the wheel package.

Dependencies are missing.

When you install using pip, all dependencies should install as well. However, depending on your Python configuration, you may need to install the dependencies manually. Device Cloud requires the following packages:

  • paho-mqtt

  • requests

  • websocket-client

  • PySocks to support connections through a proxy server

When you install the device-cloud package and any dependencies, ensure you use the --upgrade option to install the most recent release of the packages.

When you run applications as a service using systemd on Linux, including the device manager, the files are not found.

Depending on your Python configuration, packages typically install in your local site-packages directory instead of the global site-packages or dist-packages directory. For example, the file may be located in the yourHomeDir/.local/lib/python2.7/site-packages. Use the --target option when you run pip and specify the global site-packages or dist-packages directory.

When you run a proxy server on Windows 10, you are unable to use the device console or remote access to connect to a device and the websocket-client fails to connect.

When using a proxy server on Windows 10, specify the proxy configuration information in the websocket-client package, for example, the socket type must be stream or datagram, do not use 0.