Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while importing the model #18

Closed
lakshman-1396 opened this issue Feb 24, 2020 · 6 comments
Closed

Error while importing the model #18

lakshman-1396 opened this issue Feb 24, 2020 · 6 comments

Comments

@lakshman-1396
Copy link

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
Copy link
Owner

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

  • Recompiling the library yourself. In doing so the library is compiled with the same numpy version as you use in your project.
  • Use a different version of numpy, some reports here suggest version 1.16.1 should work, but you would have to experiment yourself.

@lakshman-1396
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

lakshman-1396 commented Feb 26, 2020

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 added a commit that referenced this issue Feb 26, 2020
Previous versions can cause "ufunc size changed" errors, see #18
@iamDecode
Copy link
Owner

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants