Scipy.optimize not working in Python

I can not use the optimization package from scipy, here is the errors I get when I try to import scipy.optimize.

In Python 3:
ImportError: /usr/local/lib/python3.5/dist-packages/scipy/sparse/_csparsetools.cpython-35m-x86_64-linux-gnu.so: failed to map segment from shared object: Cannot allocate memory

Python 2:
ImportError: /usr/local/lib/python2.7/dist-packages/scipy/special/_ufuncs_cxx.so: failed to map segment from shared object: Cannot allocate memory

I can use this package on my computer with Python 3.5.2 and SciPy 0.18.1.

3 Likes

Maybe you ask too much memory?

I believe the memory you are limited to are plenty for loading scipy.optimize. Maybe it is some permission issues?
The binary size is only 2MB.
2.0M /usr/local/lib/python3.5/dist-packages/scipy/sparse/_csparsetools.cpython-35m-x86_64-linux-gnu.so

I think about your code.

Code? Simply write this code and you will experience the error:
import scipy.optimize

OK.
So tell the team about this bug.

Just to add my two cents. One line of Python 2 (for Bender ep. 3)

from scipy.optimize import curve_fit

can randomly run with a common “Failure” output or raise

ImportError: /usr/local/lib/python2.7/dist-packages/scipy/special/_ufuncs_cxx.so: failed to map segment from shared object: Cannot allocate memory

Hello,
I had the same error while trying to import the scipy.optimize module. Did you find a way to solve the issue ?

its scipy in general:

Does CG know about this? Do they have an official position? (I can’t tell if this is a bug, or a purposeful limitation.) Scipy would be nice for multi-agent competitions since deciding where to send resources can be thought of as a linear programming problem.

I too have this problem with:

from scipy.optimize import minimize

results in:

ImportError: /usr/local/lib/python3.5/dist-packages/scipy/sparse/_csparsetools.cpython-35m-x86_64-linux-gnu.so: failed to map segment from shared object: Cannot allocate memory

Sorry about that. We’ll check it.

Any update on scipy? :slight_smile:

It will actually be fixed soon. I went to the devs, and apparently they were already on it. It was blocked a long time by some architecture limitation.

1 Like

This should be fixed this week if we don’t see regressions.