Forums

ValueError: Buffer dtype mismatch, expected 'SIZE_t' but got 'int'

I'm trying to host a machine learning web-app with flask GUI.. The GUI is completely operational but whenever I enter an input to my model, it crashes and I get "ValueError: Buffer dtype mismatch, expected 'SIZE_t' but got 'int'" in the error log. I got a similar error on my machine a while and I found that the model was created on a 32-bit OS so i trained the model on my 64-bit machine OS(Windows 64-bit)and it worked. So I tried to use the 64-bit trained model and then the 32-bit trained model but I got the same error in both cases. So finally I tried to run the training script on pythonanwhere itself and trained a model here too. Still it's giving the same error result.

I'm confused please help.

Here's the complete error log(it's the same everytime):

2020-03-27 06:53:57,972: Exception on /getURL [POST] Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "/home/nnneeerrraaajjj/mysite/app.py", line 42, in getURL model = load(savedModelDirectory + "/phish-model.joblib") File "/usr/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 605, in load obj = _unpickle(fobj, filename, mmap_mode) File "/usr/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 529, in _unpickle obj = unpickler.load() File "/usr/lib/python3.7/pickle.py", line 1088, in load dispatchkey[0] File "/usr/lib/python3.7/pickle.py", line 1436, in load_reduce stack[-1] = func(*args) File "sklearn/tree/_tree.pyx", line 607, in sklearn.tree._tree.Tree.cinit ValueError: Buffer dtype mismatch, expected 'SIZE_t' but got 'int'