Skip to content

Instantly share code, notes, and snippets.

@lbluque
Last active May 23, 2020 11:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lbluque/1bed77425fc531a882cfcca68dd3cb6e to your computer and use it in GitHub Desktop.
Save lbluque/1bed77425fc531a882cfcca68dd3cb6e to your computer and use it in GitHub Desktop.
TomoPy Dev Build

Build TomoPy from source!

First you need to install TomoPy's strict (and if you want optional) python dependecies.

I suggest that you use the conda package manager to do so, but if you insist you can also use pip. With conda:

  1. Install strict dependencies: * conda install six numpy scipy h5py scikit-image matplotlib * Most other dependencies you can find on dgursoy channel: conda install -c dgursoy tifffile pywavelets dxchange Note: installing dxchange from dgursoy channel will take care of optional dependencies as well.
  2. Install optional dependencies (you only need to do so if installing [dxchange]http://dxchange.readthedocs.io from source): * conda install astropy and conda install -c dgursoy dxfile edffile spefile netcdf4 olefile

With pip:

  1. Install strict dependencies: * pip install six numpy scipy h5py scikit-image matplotlib tifffile pywavelets * You need to install dxchange, either from conda as listed above or from source with: python setup.py install from the top level directory of the source code.
  2. Install optional dependecies: * pip install astropy netcdf4 olefile. * The missing optional dependecies are not on PyPi, but you can still install from conda as detailed above.

You will also need to build FFTW3 if you do not have it built yet:

NOTE: If building on OS-X make sure you have xcode command line tools installed: xcode-select --install

  1. Download the FFTW 3.3.4 source
  2. Extract the tar file: tar xvf fftw-3.3.4.tar.gz and move the source code to you prefered location.
  3. cd into the extracted fftw-3.3.4 directory.
  4. Build fftw (we will do this as required by pyFFTW, so both TomoPy and pyFFTW can use the same FFTW libraries): * ./configure --enable-shared --enable-threads --disable-fortran --enable-float --enable-sse * make * make install *You may need to use sudo for this. * Now 2 more times to support the required data types: * ./configure --enable-shared --enable-threads --disable-fortran --enable-long-double * make * make install * ./configure --enable-shared --enable-threads --disable-fortran --enable-sse * make * make install * NOTE: --sse option is for Pentium III+ processors, you may need to use a different option depending on the arquitecture you are running on. * Finally: cd tests && make check-local. If all test passed then you're well on your way.

We left out pyFFTW, which is also a strict dependecy. You can install from conda from dgursoy channel or one of these several other channels. But since we built FFTW3 lets go ahead and use pip:

  • pip install pyfftw

Finally lets build TomoPy:

  1. clone the official repo or better yet create your own fork and clone that.
  2. In the top level directory of the tomopy source code: python setupy.py build
  3. And finally python setup.py install or python setupy.py develop if you are planning to develop and contribute.

Don't forget to also install nose for unit tests!

Here is a table summarizing TomoPy's dependencies and where you can install them from.

###TomoPy Dependencies

Dependency Package Install with Notes
Strict FFTW make
Strict six conda/pip
Strict numpy conda/pip
Strict scipy conda/pip
Strict h5py conda/pip with pip make sure hdf5 libraries are installed
Strict scikit-image conda/pip
Strict matplotlib conda/pip required by scikit-image
Strict tifffile conda/pip conda on dgursoy channel
Strict pywavelets conda/pip conda on dgursoy channel
Strict pyFFTW conda/pip pip requires building FFTW/conda on dgursoy channel
Strict dxchange conda/source conda on dgursoy channel/ dxchange source
Optional astropy conda/pip
Optional netcdf4 conda/pip conda on dgursoy channel
Optional olefile conda/pip conda on dgursoy channel
Optional dxfile conda conda on dgursoy channel
Optional spefile conda conda on dgursoy channel
Optional edffile conda conda on dgursoy channel
@ssomnath
Copy link

note for anyone reading this - while I cannot speak to the dependencies, the last few steps for building TomoPy are valid for TomoPy < 1.5.

@lbluque
Copy link
Author

lbluque commented Jan 18, 2020

note for anyone reading this - while I cannot speak to the dependencies, the last few steps for building TomoPy are valid for TomoPy < 1.5.

Thanks @ssomnath. Indeed this gist is from a while back and has not been updated for the newer versions of Tomopy.

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