This issue is to document my experience building a Windows conda package for the python stfio module. While this does work, I find that it is relatively impractical at this point due to dependency issues. Should this change in future, I hope that the developers, or anyone else who is interested, can use my work as a starting point to make and distribute conda packages for stfio.
My motivation for building this package was so that I could have a single package file that I could easily install onto several Windows workstations, and be able to install the package into virtual environments for self-contained development.
For those that are not familiar with conda, it's the package manager used by the Anaconda python distribution. In contrast to pip, it allows packaging of non-python libraries, so it's more like apt-get or yum on Linux. This isn't a killer feature on Linux, since you can just use apt-get or yum, etc. to manage these non-python dependencies, but on Windows, it's very helpful since there is no such system package manager.
My work can be found in the conda branch of my fork. To build the package, you need the Anaconda python distribution, plus the same toolchain dependencies as Stimfit (VC++ 2008, Boost, SWIG and git) installed in the usual locations (see prerequisites.rst). You don't need the library dependencies (HDF5, Biosig); these are handled automatically. Then do:
git clone https://github.com/kh90909/stimfit.git
git checkout conda
cd dist/conda
conda build py-stfio
The build will finish with a message indicating the location of the .tar.bz2 conda package that you can install into your Anaconda installation, or a conda-managed virtual environment . You can also upload this package to the public binstar.org repository so that you can access it from other locations or share it with others. By default, conda builds for the architecture (i.e. 32 or 64-bit) of the machine the package is built on. To target a different architecture, try the instructions here. Conda is capable of building packages for Linux and Mac as well as Windows, however, my packages only contain Windows build scripts. They should work for both 32 and 64-bit architectures, but I have only tested them on 64-bit.
Sounds great, so far, but when you look under the hood to see what I had to do for the library dependencies, you'll see that updating these when new versions are released will be much less simple than it should be.
In an ideal world, suitable conda packages for hdf5* and biosig would be provided and maintained by their developers or the python distribution. In that case, everything would be simple. Back the real world, these packages don't exist, so I had to build them too. I had the choice of creating packages that build from source, or that grab the binaries from the appropriate website and package them up. I felt the former was untenable. With the burden of setting up and maintaining all the necessary build tools, the likelihood of anyone going to the trouble of building these packages is small. So, I built binary packages, and this is where things started to get complicated:
- The Windows VS2008 HDF5 binaries are only made available in self-installing exe form, which does not support a silent extract-only or install option. To get around this, I had to make a conda package for the command-line version of 7-zip which is needed to extract the full version of 7-zip which in turn is needed to extract the HDF5 exe!
- Recent Biosig Windows binary releases omit the DLLs, for no obvious reason. The most recent version that includes them is 1.5.6, so I had to make one change (kh90909/stimfit@cbd9ec9) to biosiglib.cpp in Stimfit to make it compatible.
*Anaconda does include a hdf5 package, but unfortunately it does not have the DLLs necessary for Stimfit/stfio. I'm discussing a fix with the Anaconda maintainers, so hopefully this will be resolved in a future version.
In conclusion, building these conda packages is possible, but it's somewhat impractical because the build recipes are not future proof due to the way the dependencies are distributed. I hope to get the issues with HDF5 resolved in the future, but I don't see the same happening with biosig unless someone steps up to build and maintain conda packages for it.
This issue is to document my experience building a Windows conda package for the python stfio module. While this does work, I find that it is relatively impractical at this point due to dependency issues. Should this change in future, I hope that the developers, or anyone else who is interested, can use my work as a starting point to make and distribute conda packages for stfio.
My motivation for building this package was so that I could have a single package file that I could easily install onto several Windows workstations, and be able to install the package into virtual environments for self-contained development.
For those that are not familiar with conda, it's the package manager used by the Anaconda python distribution. In contrast to pip, it allows packaging of non-python libraries, so it's more like apt-get or yum on Linux. This isn't a killer feature on Linux, since you can just use apt-get or yum, etc. to manage these non-python dependencies, but on Windows, it's very helpful since there is no such system package manager.
My work can be found in the conda branch of my fork. To build the package, you need the Anaconda python distribution, plus the same toolchain dependencies as Stimfit (VC++ 2008, Boost, SWIG and git) installed in the usual locations (see prerequisites.rst). You don't need the library dependencies (HDF5, Biosig); these are handled automatically. Then do:
The build will finish with a message indicating the location of the
.tar.bz2conda package that you can install into your Anaconda installation, or a conda-managed virtual environment . You can also upload this package to the public binstar.org repository so that you can access it from other locations or share it with others. By default, conda builds for the architecture (i.e. 32 or 64-bit) of the machine the package is built on. To target a different architecture, try the instructions here. Conda is capable of building packages for Linux and Mac as well as Windows, however, my packages only contain Windows build scripts. They should work for both 32 and 64-bit architectures, but I have only tested them on 64-bit.Sounds great, so far, but when you look under the hood to see what I had to do for the library dependencies, you'll see that updating these when new versions are released will be much less simple than it should be.
In an ideal world, suitable conda packages for hdf5* and biosig would be provided and maintained by their developers or the python distribution. In that case, everything would be simple. Back the real world, these packages don't exist, so I had to build them too. I had the choice of creating packages that build from source, or that grab the binaries from the appropriate website and package them up. I felt the former was untenable. With the burden of setting up and maintaining all the necessary build tools, the likelihood of anyone going to the trouble of building these packages is small. So, I built binary packages, and this is where things started to get complicated:
*Anaconda does include a hdf5 package, but unfortunately it does not have the DLLs necessary for Stimfit/stfio. I'm discussing a fix with the Anaconda maintainers, so hopefully this will be resolved in a future version.
In conclusion, building these conda packages is possible, but it's somewhat impractical because the build recipes are not future proof due to the way the dependencies are distributed. I hope to get the issues with HDF5 resolved in the future, but I don't see the same happening with biosig unless someone steps up to build and maintain conda packages for it.