Software Development

Install Any pip Package Globally

Instead of the package installing in:


and install it globally and have it accessed from any Linux user, install it with sudo -H flag. For example:

sudo -H pip3 install seaborn

The above installs it in /usr/local/lib/python3.5/dist-packages and there accessible globally by any user or Python application.

This issue arose when I was trying to run a Jupyter notebook. There was a missing seaborn Python package but it was only installed in the .local folder of the logged in user.

Software Development

Python Unicode Encode Errors

It’s sometimes stressful when working with string conversion in Python while coming across encoding errors. An example is the following error that was generated when I converted a JSON file into CSV so that I can analyze the data using pandas:

‘ascii’ codec can’t encode character u’\xe9′ in position 2

The JSON file was generated from an Influx DB instance via cURL. These links from Stack Overflow really helped. Please read the first two answers from each question. The second question’s most voted answer gives a detailed description on why you should not do a system wide change to utf-8 encoding as opposed to the first question’s most voted answer.

Further reading: Getting unicode right in Python

Internet of Things

Python UUIDs

An interesting article I read on generating UUIDs using Python:

I’m currently exploring the use of UUIDs to create unique identification for IoT sensor devices.

Will post more later here on what I find out and how I’ll implement it. I’m currently implementing a virtual sensor since I don’t have the actual devices. My host device for the sensor is a *NIX based system. e.g. Raspberry Pi Raspbian (for testing), MacOS (for development).