Python runs within Terminal, but you do not need to use Python directly to run druid. It’s just that druid is written in Python and needs the right Python stuffs to be on your machine.
You should not need to get druid from github unless you want to modify druid’s code. It’s recommended to install the monome-druid package using pip.
On a Mac, the file should just be called druid. I’m not sure where exactly this file winds up on OSX. Could someone on a Mac who’s gotten druid to work help out by sharing the output of the command:
which druid
The which program shows the exact file location where druid is installed, and if we can guess where that’s supposed to be you should be able to edit your PATH to tell Terminal how to find it. Once you’ve done that, it should be possible to close and reopen Terminal, then type just druid to run druid, no matter where the actual program file is or which folder you’re looking at in Terminal.
Terminal is the program used on Mac to access the default “shell” for interacting with your operating system, letting you move around to different directories (cd some-dir/), list files (ls) read text files (cat file.txt), and run programs (including: cd, ls, cat, brew, python3, pip3, druid, …). This is an example of a read-evaluate-print loop (REPL):
- it reads your input,
- evaluates it to see if it is a valid command and execute it if it knows how
- then prints whatever the output was. A lot of programs (like
cd for example) might print nothing at all unless something is wrong (directory not found, etc.)
- then loops back to the top, waiting for new input.
Some programs you run are themselves REPLs. Python is one such example, but you should not need to use Python to use druid, you just need to use it to install some stuff. But if you were to run just python3 by itself, the default behavior is to show you a Python REPL, that looks something like this:
$ python3
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22)
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
$
It’s common for the default operating system REPL (the “shell”) to show you an $ prompt, whereas >>> is the prompt Python uses. Often there will be something like a username and/or directory name before the $ in the default shell. But we don’t need to do anything inside Python in order to set up or use druid, so we use quit() to exit back to the shell.
pip is another program written in Python for installing Python packages. druid is published as a Python package, so to get it, you need pip. But to get pip working, you need to first get Python set up. Then you need to update pip, but pip sorta can’t update itself (or something??) so you have to use python3 to run the pip package, which you’re instructing to install pip, but to upgrade pip instead if it’s already installed, and the whole thing gets to be sort of a mouthful:
python3 -m pip install --upgrade pip
^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^
hey python, run the module "pip" and pass this stuff to the "pip" module
Adding to the confusion, Mac and Linux systems were already relying heavily on Python 2 and calling its tools python (the Python interpreter) and pip when the backwards-incompatible Python 3 came out, so on most systems these are called python3 and pip3 to avoid breaking stuff that is/was still depending on Python 2. This means that to use pip on its own you actually want to run pip3 so that you’re not trying to install Python 3 packages into a Python 2 environment. But the actual package for pip is called pip, not pip3, so inside of Python it’s just called pip, hence python3 -m pip.
So that’s a whole ordeal! But now we’re ready to install actual Python packages. Currently, setuptools is also needed to run the installation process for druid, so we install that first.
pip3 install --upgrade setuptools
pip3 install monome-druid
The good news is that after going through all this trouble, the only thing you should need to run to update druid in the future is pip3 install --upgrade monome-druid.
At this point, what’s supposed to happen is that pip should put the druid program in some place where your shell (Terminal) can find it. If that doesn’t work, pip is supposed to print out a message telling you where the program is and that it’s not accessible to your terminal until you add it to your PATH variable.
Interestingly, to sort of come full circle: even if the druid program is not on your PATH, druid is just a Python program, and once it’s installed its code is accessible to Python. This means that you can actually run the druid REPL inside a Python REPL inside your Terminal REPL:
$ python3
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22)
Type "help", "copyright", "credits" or "license" for more information.
>>> from druid.cli import repl
>>> repl()
//// druid. q to quit. h for help
> q
bye.
>>> quit()
$