Closed mattharrigan closed 7 years ago
It doesn't support Python3 now, but shouldn't be too difficult to port. It's on the todo list, but please feel free to start a Python3 branch!
+1
Lack of python3 was a total showstopper for me. If a scikit-learn GaussianProcess implementation doesn't seem easier for my use case I may port this myself.
Hey @Jwely @mattharrigan, I've just started a new branch aimed at moving to Python3. There are likely to be a large number of bugs, but it seems that the basic functionality for at least 2D plotting is there.
See: https://github.com/capaulson/pyKriging/tree/Python3-Support
More coming shortly, I'll leave open until Python3 support is in master.
To get this to work I needed to run the following in Ubuntu 16.04:
apt-get install python3-pip python3-numpy python3-matplotlib python3-scipy pip3 install inspyred apt-get install python3-cairocffi
I've attached a screen shot of the expected result.
Also, to install the Python3 version, you would do:
git clone https://github.com/capaulson/pyKriging.git
(or git pull, if you've already cloned it)
git checkout Python3-Support
python3 setup.py install
edit: seems that the plotting library for 3D isocontour on my system isn't running. seems that you need vtk compiled with Python3 support. I'm trying to build vtk following these instructions: http://ghoshbishakh.github.io/blog/blogpost/2016/07/13/building-vtk-with-python3-wrappers.html
I've done a bit more work on Py3 support in PR #16. Some tests would be good to check that things aren't breaking. ;-) I'm running the examples to check that they don't crash, but I'm not sure how to check if it's doing the right thing.
@takluyver the quickest way to check is to plot a test function contour lines over the end result (scaled the same). The 2D_simple_train.py example shows how to do this. Simply pass the test function to the main Kriging call: 'testfunction=testfun'. This then plots black contours on the filled color plot that is predicted from PyKriging. That provides a quick visual check to make sure the code is working. I'll take a look at the PR this weekend. Have you tested in in Py2.7?
Also, @takluyver thanks for the contributions on this code!!
I've posted on #16 screenshots of running 2D_simple_train on Python 3 and 2; it appears to be working nicely. I assume the choice of sampling points in non-deterministic, so we wouldn't expect those to be the same.
I've just merged Python3 support into the main branch. Closing this thread now
In Debian Linux 4.13.0-1-amd64 #1 SMP Debian 4.13.4-2 (2017-10-15) x86_64 GNU/Linux
,
with python 3.5.4
, The package pykriging
installed from the pip sources (using pip3
, pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
) still produces the same issue,
# python3 -c "import pyKriging"
...
except Exception, err:
^
SyntaxError: invalid syntax
Fixed with,
git clone https://github.com/capaulson/pyKriging.git
cd pyKriging
python3 setup.py install # installed as root
I'm not sure why, if the python3 support was merged months ago, the pip package had the same problems. That's why i'm posting at this issue.
It will need a new version released on PyPI before you can pip install
it with the Python 3 support.
I see that the version on PyPI is the 0.1.0, though this repo is 0.2.0. Why the update isn't sent?
Making a release is a separate thing from updating the repo - it's up to @capaulson when he wants to release.
Does pykriging support python 3? I'm using 3.4 and get the following when trying to do the demo:
Traceback (most recent call last): File "D:/MRSE/apdl-submodels/krige.py", line 1, in
import pyKriging
File "C:\Anaconda\envs\full-py3\lib\site-packages\pyKriginginit.py", line 2, in
from .krige import *
File "C:\Anaconda\envs\full-py3\lib\site-packages\pyKriging\krige.py", line 142
except Exception, err:
^
SyntaxError: invalid syntax
If its not supported, is python 3 support planned?