Closed bcipolli closed 8 years ago
Chatted with @binarybottle , and decided this is a priority. I'm working on this here: https://travis-ci.org/bcipolli/mindboggle
Thank you for recommending travis-ci -- what an incredible resource!
I have been using Continuum's miniconda's python and to install some python libraries, including vtk:
conda install --yes numpy scipy matplotlib pandas nose networkx traits vtk ipython VTK_DIR=${INSTALL_PREFIX}/lib/vtk-5.10
I see with travis, you are specifying a python version and trying to install vtk independently after wget: "$ tar xzvf vtk-precise64.tar.gz -C ~". I have found vtk to be difficult to install. Can we use miniconda's version?
Sure; I had no idea how to best install VTK, so I found a sample travis script and copied that. Your way sounds more reliable!
travis supports testing on quite a few different versions of python, but miniconda's downloads include only 2.7 and 3.4 (http://conda.pydata.org/miniconda.html). Should I simply copy mindboggle/setup_mindboggle.sh and replace the miniconda download version when I wish to test 2.7 vs. 3.4?
Yep. You can also call the setup script from .travis.yml; they will have cloned your repo by that point.
How do you call the setup script from within .travis.yml?
On Fri, Oct 23, 2015 at 2:04 AM, Ben Cipollini notifications@github.com wrote:
Yep. You can also call the setup script from .travis.yml; they will have cloned your repo by that point.
— Reply to this email directly or view it on GitHub https://github.com/nipy/mindboggle/issues/63#issuecomment-150485314.
I do everything by finding examples. Try calling the script in the before-install
block:
https://github.com/nipy/nibabel/blob/master/.travis.yml#L47
also see: https://github.com/Theano/Theano/blob/master/.travis.yml
then you can also do: conda install vtk
I have written high-level doctests for almost all of mindboggle's functions. Functions pull test data from http://media.mindboggle.info/data/ where necessary:
>>> from mindboggle.mio.fetch_data import prep_tests
>>> urls, fetch_data = prep_tests()
>>> label_file = fetch_data(urls['left_freesurfer_labels'])
Travis worked great for all but a couple functions in the features directory, because they take more than 10 minutes to complete. On @satra's recommendation, I would like to move over to circleci so that it will enable continuous integration for all of mindboggle's functions.
Circleci.com error for build #331 (python 3.5):
conda install cmake pip numpy scipy matplotlib pandas networkx vtk ipython Fetching package metadata: .... Solving package specifications: ....
The following specifications were found to be in conflict:
vtk7 is not available on conda yet - that's what is causing your issues.
And no version of vtk comes up for "conda list" for miniconda3, for linux or macosx. Should I try to install vtk from scratch? If so, I wonder why I even bother with miniconda, since vtk is the most unreasonable of dependencies?
because vtk7 was just released and the issue as to it's packaging is still open.
Now that I am able to run the python 3 version of mindboggle on linux with vtk 7, why am I still getting the error on circleci.com:
python -c "import vtk"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'vtk'
python -c "import vtk" returned exit code 1
@binarybottle - i don't know - this would be a good thing to debug with their ssh debugging.
When I SSH into circleci.com, I continue to get the above error when I try to import vtk, even when I try to set the PATH, PYTHONPATH, or LD_LIBRARY_PATH to /home/ubuntu/miniconda3/lib/cmake/vtk-7.0. Any suggestions?
on circleci where is vtk getting installed? i'm assuming that's happening without an error. it is possible that vtk is not getting installed in the same python as the python you are using to run the tests. so when you ssh, find out which python you are calling and check it's site-packages. also check the site-packages of the other python binaries on the system.
You are absolutely correct about the discrepancy in pythons. I have been in communication with the folks at Clinical Graphics about their conda vtk installation (https://anaconda.org/clinicalgraphics/vtk).
Korijn Van Golen:
When you are setting up your python environment, you should do so through Miniconda. Once you've installed it, you can create a python environment to work with and install your libraries in it. Like this:
C:\Development\Projects>conda create -n my_env -c clinicalgraphics python vtk
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ........
Solving package specifications: .........Package plan for installation in environment C:\Users\Korijn\Miniconda3\envs\my_env:
The following packages will be downloaded:
package build setuptools-20.6.7 py35_0 765 KB defaults The following NEW packages will be INSTALLED:
msvc_runtime: 1.0.1-vc14_0 defaults [vc14] pip: 8.1.1-py35_1 defaults python: 3.5.1-4 defaults setuptools: 20.6.7-py35_0 defaults vs2015_runtime: 14.00.23026.0-0 defaults vtk: 7.0.0-py35_2 clinicalgraphics wheel: 0.29.0-py35_0 defaults
Proceed ([y]/n)? y
Fetching packages ...
setuptools-20. 100% |###############################| Time: 0:00:01 442.58 kB/s
Extracting packages ...
[ COMPLETE ]|##################################################| 100%
Linking packages ...
[ COMPLETE ]|##################################################| 100%To activate this environment, use:
> activate my_env
C:\Development\Projects>activate my_env
Deactivating environment "C:\Users\Korijn\Miniconda3"...
Activating environment "C:\Users\Korijn\Miniconda3\envs\my_env"...[my_env] C:\Development\Projects>python
Python 3.5.1 |Continuum Analytics, Inc.| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.import vtk
On Codeship we use the following:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh bash ~/miniconda.sh -b -p $HOME/miniconda export PATH="$HOME/miniconda/bin:$PATH" conda config --set show_channel_urls yes --set always_yes yes conda config --add channels clinicalgraphics conda update conda --quiet conda install conda-build anaconda-client --quiet conda env create --quiet
source activate
export PYTHONPATH="$PYTHONPATH:$HOME/miniconda/envs/ /lib/python3.5/site-packages/vtk" Note the PATH changes, we prepend the New conda environment to the PATH, so if you type Python, it finds the right version.
Ivo Flipse:
Looking at the logs from Circle CI:
The bash ~/miniconda.sh step reports:
You currently have a PYTHONPATH environment variable set. This may cause unexpected behavior when running the Python interpreter in Miniconda3. For best results, please verify that your PYTHONPATH only points to directories of packages that are compatible with the Python interpreter in Miniconda3: /home/ubuntu/miniconda3
So you might want to verify that it is correct. Judging by your circle.yml I guess that it is.
Given that all your conda commands work though, it seems that up to there everything is working as intended.
python setup.py install though runs on your system Python and not the conda python. So I reckon Miniconda is added to the end of the path, not at the beginning. When it looks up conda, it can't find it in your system Python install, whereas looking for python does.
Running the more specific commands does seem to work.
Here's what Ilastik does: https://github.com/ilastik/ilastik/blob/master/circle.yml
Finally -- All paths are finally working on build #498!: https://circleci.com/gh/nipy/mindboggle/498
Thank you for your help! I have updated the circle.yml file after following the excellent advice on http://stiglerdiet.com/blog/2015/Nov/24/my-python-environment-workflow-with-conda/
The https://github.com/ilastik/ilastik/blob/master/circle.yml and https://circleci.com/docs/config-sample/ links were also helpful. Now the dependencies are in an environment.yml file, as per https://github.com/conda/conda-env:
name: mindboggle-env
channels:
- clinicalgraphics
dependencies:
- python=3.5.1
- vtk=7.0.0
#-------------------------------------------------------------------------
# nipype:
#-------------------------------------------------------------------------
- scipy
- networkx
- lxml
- simplejson
- future
- nose
- pip
- pip:
- nibabel
- prov
- traits
- xvfbwrapper
- https://github.com/nipy/nipype/archive/master.zip
#-------------------------------------------------------------------------
# mindboggle's remaining dependencies:
#-------------------------------------------------------------------------
- cmake
- matplotlib
- numpy
- pandas
#-------------------------------------------------------------------------
# additional testing tools:
#-------------------------------------------------------------------------
- ipython
- pytest
- coverage
As of build 541, all tests for the python 3 version of mindboggle are passing (when the circleci service doesn't time out)!
Highly recommend to have some very basic unit tests and use
travis.ci
to validate that a merge doesn't break the build. Matters less now before release, but post-release it could help a lot, and it doesn't take too much to do...