Skip to content

Setting up your environment on OS X

Patrick Schmid edited this page Jan 29, 2021 · 1 revision

These instructions are based on the excellent writeup here.

Setup pyenv

pyenv lets you run multiple versions of python on your machine in a self-contained manner.

# Install Homebrew if it isn't already available
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

# Install pyenv
brew install pyenv 

# Add pyenv initializer to shell startup script
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile 

# Reload your profile
source ~/.bash_profile

Install all of the supported versions of python

You'll now want to install all supported versions of python so that you can test your code locally. Only PRs with passing tests will be accepted. At the time of writing, these were the most recent of the python versions available.

pyenv install 3.6.12
pyenv install 3.7.9
pyenv install 3.8.7
pyenv install 3.9.1

The current defalt for the repo is 3.7.9 as can by seen by the .python-version file.

zlib error?

If you run in to the zlib error, you'll want to follow the instructions here

Big Sur: configure: error: C compiler cannot create executables

If you run in to issues installing on OS X 11.1 (Big Sur), you can look at some suggestions on this StackOverflow thread. If you don't feel like reading, you can use the nuclear option of unistalling the X Code Command Line Tools and reinstalling them

>> softwareupdate --all --install --force
Software Update Tool

Finding available software
No updates are available.

# If everything seems fine and you had them installed.... then uninstall and re-install.

>> sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Install pyenv-virtualenv

With pyenv you can install different versions of python. With pyenv-virtualenv you can make is so that you have different versions of libraries in different virtual environments so that the requirements in one project don't clobber those in another.

# Install Homebrew if it isn't already available
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Install pyenv-virtualenv
brew install pyenv-virtualenv

# Add pyenv-virtualenv initializer to shell startup script
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile

# Reload your profile
source ~/.bash_profile

After everything is installed, you can create your virtual environment for the zoomus library

pyenv virtualenv 3.7.9 zoomus
pyenv activate zoomus

Install required libraries

Now that everything is done, you can install all required libraries and test to make sure everything is setup properly.

# Activate virtual environment
pyenv activate zoomus

# Install all requirements (including the testing ones)
pip install -r requirements-tests.txt 

# Run the tests to make sure everything is working
nosetests