stgl/scarplet

Install scarplet with conda; add to conda-forge

Closed this issue ยท 7 comments

This issue is in regards to my JOSS review at openjournals/joss-reviews/issues/1066.

First off, great work! ๐ŸŽ‰

I'll begin with a checklist of things that, in my opinion, will make installation of scarplet significantly easier and, as such, more accessible. More explanation follows below.

  • Add installation instructions using conda
  • Add scarplet to conda-forge
  • Remove osr from install_requires in setup.py

Problems with scarplet installation

I've encountered some issues with installing scarplet on both Mac and Linux. I haven't tried Windows but I suspect there will be problems there as well (but maybe you aren't interested in supporting Windows, anyway, which is fine). I think the main issue, as you mention in your installation instructions, is with gdal and fftw.

Your instructions for installing these dependencies on Linux use apt-get. In my opinion, this is asking too much of the user. In most cases users will not even have root access - as is the case with me.

There is a similar issue on Mac. Installing homebrew is asking quite a lot. I find it to be quite invasive and am unwilling to install it on my Mac. That said, this might be a fine solution for someone who already uses homebrew - I assume, anyway - I haven't actually gone through the process of installing scarplet with homebrew.

Add conda-install instructions

I propose you add to your installation instructions (replace, maybe?) how to install scarplet with conda. It's way simpler on both Linux and Mac (and maybe Windows) as all of you dependencies are already available as conda packages. This is how I installed scarplet both on Linux and Mac. It was a snap.

The procedure is basically,

conda install --file=requirements.txt -c conda-forge
python setup.py develop 

The first line installs all of your dependences from the conda-forge channel (including gdal, fftw, etc.) and the second line installs scarplet (from source).

Add scarplet to conda-forge

I also suggest adding your package to conda-forge. Because of you particular dependencies, I think this makes sense as they are already all available there. I would be happy, with your permission, to even get this started. It's pretty simple. Once available on conda-forge, your installation instructions would simply be,

conda install scarplet -c conda-forge

regardless of the platform.

I find Anaconda to be a much better way to go as it can easily be installed in a users home directory, is not invasive, and is easily uninstalled. Users can either install the full Anaconda distribution or a minimal version. I normally use the minimal one.

Remove osr dependency

A final small thing. In setup.py you have osr listed in install_requires. I'm not sure this is the package you actually want. I believe what you want is the osr that comes with gdal. Since it comes along with gdal, you shouldn't need to list it. The way it is now, I believe what's installed is a different osr (OpenSourceRadio?).

In case you want to put this on conda-forge, this a meta.yaml file you could use,

{% set version = "0.1.0" %}

package:
  name: scarplet
  version: {{ version }}

source:
  url: https://github.com/rmsare/scarplet/archive/v{{ version }}.tar.gz
  sha256: f7d4c2f5ab9d7b9738e68c31c572c7ae4ecce41582329a85850187f3a7118dc0

build:
  noarch: python
  number: 0
  script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv"

requirements:
  host:
    - python
    - pip
    - setuptools
  run:
    - python
    - numexpr
    - numpy
    - matplotlib
    - gdal
    - pyfftw
    - rasterio
    - scipy

test:
  imports:
    - scarplet

about:
  home: http://github.com/rmsare/scarplet
  license: MIT
  license_family: MIT
  license_file: LICENSE
  summary: Topographic edge detection of fault scarps and other landforms in digital elevation data
  description: |
    A Python package for applying template matching techniques to
    digital elevation data, in particular for detecting and measuring
    the maturity of fault scarps and other landforms.
  doc_url: https://scarplet.readthedocs.io
  dev_url: http://github.com/rmsare/scarplet

extra:
  recipe-maintainers:
    - mcflugen
    - rmsare

@rmsare Please note that the above recipe will build scarplet so that it can be installed with any Python version (including 2.7). Although you indicate that it's been written for Python 3.4+, it looked to me that scarplet works fine with Python 2.7 but, if it doesn't, you should indicate that in the host and run sections. So instead of

    - python

write

    - python >=3.6

That way users won't be able to install it into a Python 2.7 environment.

Thanks! I agree that conda is the way to go.

A conda recipe has been submitted over at conda-forge/staged-recipes#7026.

I've tested the conda build locally and it works (Ubuntu 14.04 LTS).

One issue this brought up is WIndows compatibility. Currently PyFFTW is not available for win32 or win64 via conda-forge, but could be installed using pip and some DLL editing (:(). There are a few workarounds for Windows install documented on the pyfftw issue tracker but it's a bit involved.

I've disabled Windows builds in the conda recipe for the time being.

@rmsare I would keep the noarch build and not disable Windows. That way, if a Windows user tries to conda-install scarplet, conda will report an error saying that PyFFTW isn't available for Windows. However, once someone creates a PyFFTW build for Windows, scarplet will install just fine.

You can read more about this in the conda-forge docs about building norarch packages.

@mcflugen - Good point, better to fail informatively for now. I've restored noarch.

This causes conda CI to fail for these architectures. Will this be an issue for the recipe review?

The package is now up on conda-forge, and the latest version incorporates the examples and other review changes. Thanks for your help with the packaging!