Python setup
December 10, 2018 ยท View on GitHub
Here are some specific instructions on how to setup your Mac OS X machine to run opensauce-python using the Homebrew package manager.
Python setup
You need to install Python 2.7 or 3.4+ and the Python packages that OpenSauce depends on.
We describe how to do this using the Homebrew package manager. Follow the instructions on the Homebrew website to install it. Then run
$ brew doctor
to see how you can configure your system so that Homebrew is in your path. For
example, you can add the line export PATH="/usr/local/bin:$PATH" to your
.bash_profile.
If you want Python 2, do
$ brew install python
$ brew install python@2
$ pip2 install --upgrade pip setuptools wheel virtualenv
$ virtualenv osvenv -p python2
$ source osvenv/bin/activate
$ pip2 install numpy scipy
If you want to install the Python 3 versions, use
$ brew install python
$ brew install python@2
$ pip3 install --upgrade pip setuptools wheel virtualenv
$ virtualenv osvenv -p python3
$ source osvenv/bin/activate
$ pip3 install numpy scipy
In the above, we suggest using virtual environments as this is standard
practice. The command beginning with virtualenv creates a new virtual
environment named osenv. The command beginning with source activates the
virtual environment, so that when you install numpy and scipy in the next
command, these packages are installed into the virtual environment. To exit the
virtual environment, run deactivate on the command line.
To learn more about Python virtual environments, see the virtualenv documentation.
(Note that Homebrew now uses Python 3 as the default, so you need to install both Python 2 and Python 3. Apparently, there are some dependencies or linking issues that are resolved by doing this.)
To run the Homebrew's Python (not the pre-installed version on OS X), use
$ python2 or $ python3 depending on which Python version you want to run.
Now the Homebrew package versions of Python, NumPy, and SciPy are installed.
REAPER setup
Install REAPER via the pyreaper Python package, by using the Python package manager pip.
For Python 2, run
$ brew install git
$ source osenv/bin/activate # activate previous virtualenv, if needed
$ pip2 install cython
$ pip2 install git+https://github.com/voicesauce/pyreaper
or for Python 3, run
$ brew install git
$ source osenv/bin/activate # activate previous virtualenv, if needed
$ pip3 install cython
$ pip3 install git+https://github.com/voicesauce/pyreaper
We try to maintain pyreaper to stay up-to-date with the official Google
REAPER repository, but this may not always
be the case. Installing REAPER via the pyreaper Python package is easiest, but
alternatively, you can build the REAPER executable as described in the
REAPER README. Building the
REAPER executable from the official Google repository may be desirable if you
need the latest version of REAPER. In order to build the REAPER executable,
you may need to install cmake via Homebrew, i.e. run brew install cmake.
Snack setup: Run Snack commands through Tcl interpreter
On many versions of OS X, Snack is installed by default as a Tcl/Tk 8.4
library. If this is the case, we can simply run Snack commands through the Tcl
interpreter using tclsh8.4.
However, for Mac OS X High Sierra, Mojave, and later versions (Mac OS X 10.13+), Tcl/Tk8.4 and Snack are not installed by default.
Mac OS X High Sierra and Mojave come with Tcl/Tk8.5 pre-installed. We have compiled a Snack Tcl 8.5 binary that you can download and use, in order to run Snack calculations. The binary has been successfully tested on both Mac OS X High Sierra (Mac OS X 10.13) and Mac OS X Mojave (Mac OS X 10.14).
The instructions below explain how you can download the Snack Tcl 8.5 binaries which we have pre-built, then place the Snack library files in the standard Tcl library directory where Tcl looks for packages.
-
First, download the Snack Tcl 8.5 zip file.
-
Then unzip the file to the Tcl library directory. On Mac OS X, Tcl8.5 looks for packages in
/System/Library/Tcl/8.5.Note: on Mac OS X El Capitan and later, System Integrity Protection is enabled by default and will prevent you from being able to modify anything in the /System directory. You need to first disable it, following instructions here.
Run the following command to unzip the Snack Tcl library files to the standard Tcl library directory:
$ sudo unzip snack-tcl85.zip -d /System/Library/Tcl/8.5 -
Check that Tcl can find the Snack library, by running the Tclsh shell.
$ tclsh8.5 % package require snack % exitWhen you run the tclsh command package require snack, it should output
2.2if the Snack library has been installed correctly. If instead it outputcan't find package snack, then the install failed.
If you want to compile the Snack Tcl library from source yourself or if the binary does not work, you can take a look at our notes for building Snack on Mac OS X here.