iamDecode / sklearn-pmml-model

A library to parse and convert PMML models into Scikit-learn estimators.
BSD 2-Clause "Simplified" License
76 stars 15 forks source link

Error while importing the model #18

Closed lakshman-1396 closed 4 years ago

lakshman-1396 commented 4 years ago

from sklearn_pmml_model.ensemble import PMMLForestClassifier

Error: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216from C header, got 192 from PyObject

iamDecode commented 4 years ago

This is an issue with NumPy. You have got a few options to fix this:

lakshman-1396 commented 4 years ago

I tried to install it manually using python setup.py install i am getting the following error

import sklearn_pmml_model from sklearn_pmml_model import tree Traceback (most recent call last): File "", line 1, in File "\ns-sisci01hd\home_s01\Citrix_Folder_Redirect\My Documents\sklearn-pmml-model\sklearn_pmml_model\tree__init__. py", line 6, in from .tree import PMMLTreeClassifier, construct_tree File "\ns-sisci01hd\home_s01\Citrix_Folder_Redirect\My Documents\sklearn-pmml-model\sklearn_pmml_model\tree\tree.py", line 4, in from sklearn_pmml_model.tree._tree import Tree, NODE_DTYPE, TREE_LEAF, TREE_UNDEFINED ModuleNotFoundError: No module named 'sklearn_pmml_model.tree._tree'

iamDecode commented 4 years ago

Hmm thats curious, setup should compile the Cython modules. To ensure the install works, run python setup.py build_ext --inplace first, then run python setup.py install.

lakshman-1396 commented 4 years ago

Same error. Cython modules are compiled during the build. why is it not recognizing the _tree module? is it something to do with the setup file? any ideas?

from sklearn_pmml_model.ensemble import PMMLForestClassifier Traceback (most recent call last): File "", line 1, in File "\ns-sisci01hd\home_s01\Citrix_Folder_Redirect\My Documents\sklearn-pmml-model\build\lib.win-amd64-3.6\sklearn_pmml_model\ensemble__init.py", line 6, in from .forest import PMMLForestClassifier File "\ns-sisci01hd\home_s01\Citrix_Folder_Redirect\My Documents\sklearn-pmml-model\build\lib.win-amd64-3.6\sklearn_pmml_model\ensemble\forest.py", line 3, in from sklearn_pmml_model.tree._tree import Tree, NODE_DTYPE File "\ns-sisci01hd\home_s01\Citrix_Folder_Redirect\My Documents\sklearn-pmml-model\build\lib.win-amd64-3.6\sklearn_pmml_model\tree\init__.py", line 6, in from .tree import PMMLTreeClassifier, construct_tree File "\ns-sisci01hd\home_s01\Citrix_Folder_Redirect\My Documents\sklearn-pmml-model\build\lib.win-amd64-3.6\sklearn_pmml_model\tree\tree.py", line 4, in from sklearn_pmml_model.tree._tree import Tree, NODE_DTYPE, TREE_LEAF, TREE_UNDEFINED ModuleNotFoundError: No module named 'sklearn_pmml_model.tree._tree'

iamDecode commented 4 years ago

Alright, I have recently introduced building wheels for the sole purpose of preventing issues with compiling, so let's not go there.

I have gone over all recent numpy versions up to a year ago and found that your original problem only occurs for numpy versions lower than 1.16.0. I have added a constraint to the installation such that this problem is automatically fixed upon pip install. (There were some more compatibility issues with the most recent version of scikit-learn that have been fixed too.)

Could you try using the library again by installing it with pip install sklearn_pmml_model==0.0.13? As far as I was able to test, this versions works.

iamDecode commented 4 years ago

Closing this issue due to inactivity. I expect the problem to be fixed, if not please let me know!