AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.16k stars 498 forks source link

Add appveyor and travisci testing #101

Closed fedorov closed 7 years ago

fedorov commented 8 years ago

One example is in https://github.com/qiicr/dcmqi

naucoin commented 8 years ago

For TravisCI, I have to use the .com site for private repositories. The first 100 builds are free, so I'm debugged the yml file.

naucoin commented 8 years ago

@fedorov When I pasted my yml file into the Travis validator: http://lint.travis-ci.org it gave an error that python is not supported for osx, it's only supported in linux. Combined with the only free for open source repositories limitation, travisci isn't going to work to test pyradiomics.

fedorov commented 8 years ago

interesting, I don't understand why -- based on this -- isn't it supposed to work? https://docs.travis-ci.com/user/languages/python/

naucoin commented 8 years ago

The second one line paragraph from the top reads:

Python builds are not available on the OSX environment.

fedorov commented 8 years ago

ah, as usual, I glanced over and missed the most important part! makes sense

fedorov commented 8 years ago

I wonder if it is worth the effort to install python from scratch on travis?

naucoin commented 8 years ago

I would vote no. If they're upfront about not providing it, there may be blocks in place to install it yourself. Add in having to debug it and I only have 100 free builds due to the private repo, I don't think that Travis is right for testing pyradiomics right now.

fedorov commented 8 years ago

I agree that 100 free builds limit is a good reason to postpone travis support until pyradiomics becomes public

naucoin commented 8 years ago

I squashed the commits and checked it in as a working version with passing feature tests for Linux on my branch.

jcfr commented 8 years ago

re: python and travis for macosx

You can use brew to install it.

See https://github.com/scikit-build/scikit-build/blob/3470742846e3398c8850f69a64680cbc709b65ca/ci/travis_driver.py#L48-L72

naucoin commented 8 years ago

For AppVeyor: Free for open source projects. $29/mo for 1 private project, $59/mo for unlimited private projects. There is a 14 day free trial that I can use to develop the yml file, but it's also not ideal for the currently private repository. All plans have maximum build job execution time of 60 minutes.

naucoin commented 8 years ago

@jcfr: I'm getting an insecure platform warning/ssl error from sitk when I used brew to install python: https://travis-ci.com/naucoin/pyradiomics/jobs/50189012 Any ideas?

jcfr commented 8 years ago

https://travis-ci.com/naucoin/pyradiomics/jobs/50189012

For some reason, I can't access the link.

an insecure platform warning/ssl error

Did you install an updated Python using brew ? along with with pyenv ?

Then you have to use pyenv to "activate" the python version of your choice, when done SimpleITK builld should work.

Some related reading:

naucoin commented 8 years ago

@jcfr: I based my changed to the travis yml file on the skikit commands, here's the pyradiomics version: https://github.com/naucoin/pyradiomics/commit/bead4c0e02f1811b2df60863976a8bf13210ddf8

The test output might be hidden since it's a private repo, here's the highlights:

Brew updated pyenv to 1.0.0 and it installed the openssl dependency, but looking more closely at the expanded output:

==> Installing pyenv dependency: openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.mavericks. ==> Pouring openssl-1.0.2h_1.mavericks.bottle.tar.gz ==> Using the sandbox ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local. Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include ==> Summary  /usr/local/Cellar/openssl/1.0.2h_1: 1,691 files, 12.3M

It successfully updated python:

Installed Python-2.7 to /Users/travis/.pyenv/versions/2.7

And then I get the openssl warning when it tries to build simpleitk.

JoostJM commented 8 years ago

@naucoin, this openssl warning I also recieved in circleCI ( #108 ), this is some problem with simpleitk I think. Do you specify a pip install? Then you can use --trusted-host www.simpleitk.org -f http://www.simpleitk.org/SimpleITK/resources/software.html to make it work. You add this to the rest of the pip call (so the total call is pip install --trusted-host www.simpleitk.org -f http://www.simpleitk.org/SimpleITK/resources/software.html SimpleITK==0.9.1)

naucoin commented 8 years ago

@joost I did specify a pip install (and had updated pip), this is the line I'm using for installing SimpleITK: pip install --trusted-host www.simpleitk.org -f http://www.simpleitk.org/SimpleITK/resources/software.html SimpleITK I'll add the version and see if that helps.

JoostJM commented 8 years ago

@naucoin Hmm, I don't think adding the version helps, I only added the version recently, and circleCI was working fine before. It was just that when I removed the --trusted-host and -f args the circleCI started throwing the ssl error. Can you mayby post the error message?

naucoin commented 8 years ago

Here's the error report:

Collecting SimpleITK==0.9.1 /Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning /Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning /Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/connection.py:303: SubjectAltNameWarning: Certificate for sourceforge.net has no subjectAltName, falling back to check for a commonName for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.) SubjectAltNameWarning Certificate did not match expected hostname: sourceforge.net. Certificate: {'notAfter': 'Dec 22 23:59:59 2016 GMT', 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'California'),), (('localityName', u'San Diego'),), (('organizationName', u'SourceForge Media, LLC'),), (('commonName', u'.sourceforge.net'),))} Exception: Traceback (most recent call last): File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 310, in run wb.build(autobuilding=True) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/wheel.py", line 750, in build self.requirement_set.prepare_files(self.finder) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 370, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 587, in _prepare_file session=self.session, hashes=hashes) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/download.py", line 810, in unpack_url hashes=hashes File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/download.py", line 649, in unpack_http_url hashes) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/download.py", line 842, in _download_http_url stream=True, File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 487, in get return self.request('GET', url, _kwargs) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/download.py", line 378, in request return super(PipSession, self).request(method, url, _args, _kwargs) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request resp = self.send(prep, _send_kwargs) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 585, in send r = adapter.send(request, _kwargs) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send resp = super(CacheControlAdapter, self).send(request, *_kw) File "/Users/travis/.pyenv/versions/2.7/lib/python2.7/site-packages/pip/vendor/requests/adapters.py", line 477, in send raise SSLError(e, request=request) SSLError: hostname 'sourceforge.net' doesn't match u'.sourceforge.net' The command "pip install --trusted-host www.simpleitk.org -f http://www.simpleitk.org/SimpleITK/resources/software.html SimpleITK==0.9.1" failed and exited with 2 during . Your build has been stopped.

fedorov commented 8 years ago

Nicole, we can approach this a bit differently. How about first downloading the SimpleITK package using wget or similar, and then installing from package? I am pretty sure it should be possible, but then we will separate the problems of download (security/certificates) from the problems of installing.

Please test locally first, you will probably need to use --no-check-certificate flag for wget.

jcfr commented 8 years ago

+1 for Andrey comment

On Sep 16, 2016 11:49 AM, "Andrey Fedorov" notifications@github.com wrote:

Nicole, we can approach this a bit differently. How about first downloading the SimpleITK package using wget or similar, and then installing from package? I am pretty sure it should be possible, but then we will separate the problems of download (security/certificates) from the problems of installing.

Please test locally first, you will probably need to use --no-check-certificate flag.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Radiomics/pyradiomics/issues/101#issuecomment-247636097, or mute the thread https://github.com/notifications/unsubscribe-auth/AANXoy9T_PAsW4d-uqEekZcjHfPcWM3Kks5qqrp7gaJpZM4J4Vgb .

naucoin commented 8 years ago

Update: doing a wget and manually installing SimpleITK did work, currently debugging a problem with nosetests picking up the wrong python version.

Fatal Python error: PyThreadState_Get: no current thread
/Users/travis/build.sh: line 45: 61991 Abort trap: 6           nosetests --nocapture --verbosity=3 tests/test_docstrings.py
The command "nosetests --nocapture --verbosity=3 tests/test_docstrings.py" exited with 134.
fedorov commented 8 years ago

What makes you think this is due to a wrong python version?

fedorov commented 8 years ago

I would try to check if SimpleITK install worked with a test that has a single line import SimpleITK

fedorov commented 8 years ago

Correction: the install probably worked, but we need to check if the installed SimpleITK is actually usable

naucoin commented 8 years ago

I have to get nosetests to run first, it's exiting before it does anything.

fedorov commented 8 years ago

it's exiting before it does anything

why do you think it is exiting before it does anything? from the error message, it appears to crash while executing the tests/test_docstrings.py test.

I am pretty sure it crashes importing SimpleITK, and every test we have, I am also pretty sure, imports SimpleITK in the first few lines it executes. To confirm this, we just need another test that imports SimpleITK and does nothing else.

naucoin commented 8 years ago

I think that because of researching the error message and looking at the full log. I'm currently trying a simple test that doesn't import anything from pyradiomics or sitk, if that works I'll add the imports back in one at a time.

jcfr commented 8 years ago

Within your test, you could print sys.executable to check that the correct python is used

The test log should also report the version

naucoin commented 8 years ago

I think the travis server did an update, there was a long delay in starting a build and now I'm getting the tests failing earlier in the process due to an XCode mismatch. I'll revisit tomorrow.

naucoin commented 8 years ago

Got past that error this morning when I restarted the build, it successfully ran the no simple itk imported test, restarting with an import.

naucoin commented 8 years ago

Just adding the import of SimpleITK to teh basic test triggered the error. Pre-test python version is: /Users/travis/.pyenv/shims/python 2.7 Inside the test script, my print out of the sys values didn't get shown, with --no-capture and --verbosity=3

fedorov commented 8 years ago

How about using virtualenv? http://docs.python-guide.org/en/latest/dev/virtualenvs/

jcfr commented 8 years ago

Hi,

There are now some reusable standalone python script to setup pyenv on branch branch on https://GitHub.com/scikit-build/scikit-ci

Otherwise, I made some good progress on scikit-ci and https://GitHub.com/scikit-build/scikit-ci-schema to provide a easy way to setup ci across appveyor, circle and Travis.

More next week, now headed to vacation until Sunday.

Thanks Jc

On Sep 28, 2016 1:02 PM, "Andrey Fedorov" notifications@github.com wrote:

How about using virtualenv? http://docs.python-guide.org/ en/latest/dev/virtualenvs/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Radiomics/pyradiomics/issues/101#issuecomment-250230293, or mute the thread https://github.com/notifications/unsubscribe-auth/AANXo4b0VR36Gs1Tju7bfVUzUT9Qijrtks5qup23gaJpZM4J4Vgb .

jcfr commented 8 years ago

Hi Nicole,

Here is the script to install pyenv: https://github.com/scikit-build/scikit-ci/blob/split-custom-step-into-reusable-module/ci/travis/install_pyenv.py

And here is the wrapper script allowing to set the env while invoking python: https://github.com/scikit-build/scikit-ci/blob/split-custom-step-into-reusable-module/ci/travis/run.bash

Usage: (check for typo, written from my phone)

$ export PYTHONVERSION=3.5
$ python Install_pyenv.py
$ bash.sh python
$ some_script_that_need_py35.py

Hth Jc

On Sep 28, 2016 12:53 PM, "Jean-Christophe Fillion-Robin" < jchris.fillionr@kitware.com> wrote:

Hi,

There are now some reusable standalone python script to setup pyenv on branch branch on https://GitHub.com/scikit-build/scikit-ci

Otherwise, I made some good progress on scikit-ci and https://GitHub.com/scikit-build/scikit-ci-schema to provide a easy way to setup ci across appveyor, circle and Travis.

More next week, now headed to vacation until Sunday.

Thanks Jc

On Sep 28, 2016 1:02 PM, "Andrey Fedorov" notifications@github.com wrote:

How about using virtualenv? http://docs.python-guide.org/e n/latest/dev/virtualenvs/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Radiomics/pyradiomics/issues/101#issuecomment-250230293, or mute the thread https://github.com/notifications/unsubscribe-auth/AANXo4b0VR36Gs1Tju7bfVUzUT9Qijrtks5qup23gaJpZM4J4Vgb .

fedorov commented 7 years ago

for the reference - an example of setup of python on appveyor: https://github.com/astropy/conda-builder-affiliated/blob/master/appveyor.yml

jcfr commented 7 years ago

Fixed by https://github.com/Radiomics/pyradiomics/commit/f7a7307aa0a4b6ced5624638151d2bf0c3c82c69 and #183