Put weave import in a try block so it fails gracefullt in Py3

This commit is contained in:
Mike Croucher 2015-02-27 15:39:10 +00:00
parent 9020a6f060
commit 82ea197972
2 changed files with 21 additions and 10 deletions

View file

@ -6,7 +6,7 @@
# http://homepages.inf.ed.ac.uk/imurray2/code/tdot/tdot.py # http://homepages.inf.ed.ac.uk/imurray2/code/tdot/tdot.py
import numpy as np import numpy as np
from scipy import linalg, weave from scipy import linalg
import types import types
import ctypes import ctypes
from ctypes import byref, c_char, c_int, c_double # TODO from ctypes import byref, c_char, c_int, c_double # TODO
@ -16,6 +16,12 @@ import os
from .config import config from .config import config
import logging import logging
try:
from scipy import weave
except ImportError:
config.set('weave', 'working', 'False')
_scipyversion = np.float64((scipy.__version__).split('.')[:2]) _scipyversion = np.float64((scipy.__version__).split('.')[:2])
_fix_dpotri_scipy_bug = True _fix_dpotri_scipy_bug = True
if np.all(_scipyversion >= np.array([0, 14])): if np.all(_scipyversion >= np.array([0, 14])):

View file

@ -10,15 +10,6 @@ A Gaussian processes framework in Python.
Continuous integration status: ![CI status](https://travis-ci.org/SheffieldML/GPy.png) Continuous integration status: ![CI status](https://travis-ci.org/SheffieldML/GPy.png)
### Moving to Python 3
Work is underway to make GPy run on Python 3. We are not there yet! Changes performed so far have retained compatibility with Python 2.6 and above.
Work done so far:
* Used 2to3 to fix relative imports
* Used 2to3 to convert print from statement to function. Some advanced uses of print meant that this could not be done in a way that retained compatibility with old versions of Python. The oldest version of Python that is supported by this version is 2.6 due to the required future imports.
* Used 2to3 to convert exceptions to Python 3 friendly versions. There are a few oustanding string exceptions to take care of that 2to3 doesn't handle. Will need to do these manually
### Citation ### Citation
@Misc{gpy2014, @Misc{gpy2014,
@ -119,6 +110,20 @@ or from within IPython
import GPy; GPy.tests() import GPy; GPy.tests()
### Moving to Python 3
Work is underway to make GPy run on Python 3. We are not there yet! Changes performed so far have retained compatibility with Python 2.6 and above.
Work done so far:
* Used 2to3 to fix relative imports
* Used 2to3 to convert print from statement to function. Some advanced uses of print meant that this could not be done in a way that retained compatibility with old versions of Python. The oldest version of Python that is supported by this version is 2.6 due to the required future imports.
* Used 2to3 to convert exceptions to Python 3 friendly versions. There are a few oustanding string exceptions to take care of that 2to3 doesn't handle. Will need to do these manually
* Handled the different imports required for ConfigParser/configparser in Py2/Py3
* In utils/linalg.py:
* Commented out the function cholupdate(L, x) since it doesn't appear to be used. Its definitely not in the tests.s
* Put the import for scipy.weave in a try/except block so that it will gracefully fail in Py3
## Funding Acknowledgements ## Funding Acknowledgements