'RuntimeError: maximum recursion depth exceeded' when trying to serialize model
See original GitHub issueWhen I try
joblib.dump(model, 'my_model.pkl', compress=9)
or to pickle the model, I get:
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 425, in save_reduce
save(state)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "/usr/lib/python2.7/pickle.py", line 687, in _batch_setitems
save(v)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 606, in save_list
self._batch_appends(iter(obj))
File "/usr/lib/python2.7/pickle.py", line 639, in _batch_appends
save(x)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 425, in save_reduce
save(state)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "/usr/lib/python2.7/pickle.py", line 687, in _batch_setitems
save(v)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 606, in save_list
self._batch_appends(iter(obj))
File "/usr/lib/python2.7/pickle.py", line 639, in _batch_appends
save(x)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 554, in save_tuple
save(element)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 425, in save_reduce
save(state)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "/usr/lib/python2.7/pickle.py", line 686, in _batch_setitems
save(k)
File "/home/moose/.local/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 280, in save
return Pickler.save(self, obj)
File "/usr/lib/python2.7/pickle.py", line 271, in save
pid = self.persistent_id(obj)
RuntimeError: maximum recursion depth exceeded
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Python: Maximum recursion depth exceeded - Stack Overflow
Method that I call to get sql results: def returnCategoryQuery(query, variables={}): cursor = db.cursor(cursors.DictCursor); catResults = []; ...
Read more >Python: Maximum Recursion Depth Exceeded [How to Fix It]
The maximum recursion depth in Python is 1000. To check it, call sys.getrecursionlimit() function. To change it, call sys.setrecursionlimit().
Read more >"maximum recursion depth exceeded " when serializing enum ...
RuntimeError : maximum recursion depth exceeded while calling a Python object. the same script under python3 works fine.
Read more >Python maximum recursion depth exceeded in comparison
The “maximum recursion depth exceeded in comparison” error is raised when you try to execute a function that exceeds Python's built in recursion...
Read more >maximum recursion depth exceeded while calling a Python ...
I'm seeing this new error with ray==1.12. The same code worked fine in 1.11 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have you tried
sys.setrecursionlimit(10000)
?https://github.com/dnouri/nolearn/commit/2f18a1cf1f67237f21ebda0573fffd4760770d40 is the problem