Skip to content

Instantly share code, notes, and snippets.

@samueljohn
Last active January 3, 2020 19:29
Show Gist options
  • Save samueljohn/14d766e49d1a1a43985c to your computer and use it in GitHub Desktop.
Save samueljohn/14d766e49d1a1a43985c to your computer and use it in GitHub Desktop.
For my own reference. Brewed Python3, numpy, scipy and the rest goes in a pyvenv.

Samuel's Python3 setup for Mac:

This document describes in which way, what packages, and from where are installed on my Macs to get a decent Python 3.x, scipy/numpy & Co setup.

Note, I switched to Python's 3.x pyvenv from virtualenv in order to handle my pip-installable packages. Also thanks to Anaconda, the whole setup is so simple now that I use this document just to remember which additional packages I like.


  • Install Homebrew

  • Install the Anaconda Python distribution

  • Optional Pyvenv (virtual env)

    • pyvenv --system-site-packages ~/Py to set up a virtual environment. Using the default symlink mode, has got an issue with brew's Python but I am using the executable from the Anaconda distribution now.
    • Don't forget to source ~/Py/bin/activate.
    • To upgrade when Anaconda has a newer Python: pyvenv --upgrade ~/Py
  • Unit testing framework:

    • pip install coverage
    • pip install nose-progressive Nose plug-in with progress bars. Run with nosetests --with-progressive
  • Progess bar

    • pip install pyprind
  • Debugging - pip install debug

  • OpenGL bindings:

    • pip install pyopengl
  • VisPy: Most promising next gen visualizations

    • git clone https://github.com/vispy/vispy.git
    • cd vispy
    • python setup.py install
  • GPU computing with numpy arrays:

    • git clone http://git.tiker.net/trees/pyopencl.git pyopencl
    • cd pyopencl
    • git submodule update --init
    • python configure.py --cl-enable-gl
    • python setup.py install
  • Cython for writing C-extensions in Python-like speak

    • pip install cython
  • Modular Data Processing Toolkit. (needs numpy):

    • git clone git://github.com/mdp-toolkit/mdp-toolkit
    • cd mdp-toolkit
    • python setup.py install
  • Memory profiling and shell tools:

    • pip install psutil
    • pip install memory_profiler
  • Read/write DICOM files (medical software) - pip install pydicom

    (or git clone and install by python3 setup.py install)


Todo

Install kivy

figure out best way to pass ars to pip so that the includes and libs of the homebrew stuff is found.

  • PyYAML ... can't find libyaml. fuck.

  • CFFI (C calling foregin functions. Needed for PyOpenCL if built from source)

    • brew install libffi
    • PKG_CONFIG_PATH=$(brew --prefix)/opt/libffi/lib/pkgconfig pip install cffi
  • GUI toolkits:

    • todo: py3 ready?
    • brew install qt
    • brew install pyside or pyqt?
    • brew install vtk --python (the --qt option is currently not working on Xcode-only Macs)
  • Audio and sound generation:

    • brew install liblo libsndfile portaudio portmidi
    • cd tmp
    • svn checkout http://pyo.googlecode.com/svn/trunk/ pyo
    • cd pyo
    • sudo python setup.py install --use-coreaudio --use-double
    • use scikit-audiolab instead?
@samueljohn
Copy link
Author

I basically switched to Anaconda and therefore removed some of the manual install steps in this doc.

@autosquid
Copy link

python in Anaconda seems built with difference options with system/homebrew versioned python. And I found it causing problem in packages where c-extensions are involved. Have you ever met similar problems?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment