Skip to content

Python prerequisites

In order to be able to run a Python application for ONEm on your machine please make sure you have installed the following:

  • Python (v3.7 or above)
  • git
  • ngrok
  • optionally, an IDE that supports Python language if you want to edit the source code

Install git

Run the following command in your terminal

  • Debian, Ubuntu, Deepin, LinuxMint:

    1
    $ sudo apt-get install git
    
  • Centos, Fedora:

    1
    $ sudo yum install git
    
  • Mac OS:

    1
    $ brew install git
    
  • Windows:

    There are a few ways to install Git on Windows.

    The official build is available on the Git website; go to git-scm.com/download/win and the download will start automatically. Run the setup and follow the instructions.

    If you use Chocolatey manager on Windows, then you can install the git package as instructed here. Note that the Chocolatey package is community maintained.

Install python >= 3.7

Developing a ONEm application requires at least python 3.7. Not to mess up with your other projects that might need a different python version, we suggest using pyenv.

Install Python dependencies:

Before you install pyenv itself, you need to install some dependencies that are required because pyenv installs Python by building from source. Here's what you need to do.

  • Debian, Ubuntu, Deepin, LinuxMint:

    1
    2
    3
    4
    5
    6
    7
    8
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get dist-upgrade
    $ sudo apt-get install build-essential checkinstall python-dev \
                           python-setuptools python-pip python-smbus
    $ sudo apt-get install libncursesw5-dev libgdbm-dev libc6-dev
    $ sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
    $ sudo apt-get install libssl-dev openssl
    
  • Centos, Fedora:

    1
    2
    $ sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite \
                       sqlite-devel openssl-devel xz xz-devel libffi-devel
    
  • Mac OS:

    1
    $ brew install openssl readline sqlite3 xz zlib
    

    When running Mojave you will also need to install the additional SDK headers:

    1
    $ xcode-select --install
    

    You'll then receive:

    1
    $ xcode-select: note: install requested for command line developer tools
    

    and be prompted in a window to update Xcode Command Line tools. After the update is completed, open a new terminal window and type:

    1
    $ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    

Install pyenv:

  • Debian, Ubuntu, Deepin, LinuxMint, CentOS, Fedora:

    1
    $ curl https://pyenv.run | bash
    

    Restart your shell so the path changes take effect. See pyenv-installer for more info.

  • Mac OS:

    1
    $ brew install pyenv
    

    Add pyenv initializer to shell startup script

    1
    $ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
    

    Reload your profile

    1
    $ source ~/.bash_profile
    
  • Windows:

    Please note that pyenv is not currently supported on Windows.

    If you do want to use a Python version manager for Windows, you can give it a try to pyenv-win.

Install python 3.7 or above using pyenv

  • Debian, Ubuntu, Deepin, LinuxMint, CentOS, Fedora, Mac OS:

    Example:

    1
    $ pyenv install 3.7.0
    
  • Windows:

    Example with pyenv-win:

    1
    $ pyenv install 3.7.0
    

    Alternatively, download the latest Python version available for Windows from official website. Run the installer and make sure to check the box that says Add Python 3.x to PATH to ensure that the interpreter will be placed in the execution path. Then click Install Now and that should be all.

Install pipenv for an easier virtual environment management

  • Debian, Ubuntu, Deepin, LinuxMint, CentOS, Fedora:

    1
    $ sudo pip install pipenv
    
  • Mac OS:

    1
    $ brew install pipenv
    

    or use:

    1
    $ pip install pipenv --user python
    

Install ngrok

Please download and install ngrok as described on the official website.

Install an IDE

If you don't already have a preferred IDE, there is plenty you can choose from. Here is a list of IDEs in no particular order: