scipy: minpack2.cpython-38-darwin.so, 2): Symbol not found: _Py_SET_TYPE
macOS 10.15.5 Python 3.8.3 numpy 1.19.0 cython 0.29.20
- create a new conda environment with Python 3.8.3
pip install numpy cython pytest pybind11
- git clean -xdf
- git checkout master
- build scipy (4c7b25e4816f6246f30bdfbe5cd7d258f4f107e6) with
python setup.py build
- install scipy via
pip install .
I then change out of the scipy directory and try to import scipy:
>>> import scipy.optimize as sciopt
sciopt.Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/andrew/miniconda3/envs/dev3/lib/python3.8/site-packages/scipy/optimize/__init__.py", line 387, in <module>
from .optimize import *
File "/Users/andrew/miniconda3/envs/dev3/lib/python3.8/site-packages/scipy/optimize/optimize.py", line 33, in <module>
from .linesearch import (line_search_wolfe1, line_search_wolfe2,
File "/Users/andrew/miniconda3/envs/dev3/lib/python3.8/site-packages/scipy/optimize/linesearch.py", line 16, in <module>
from scipy.optimize import minpack2
ImportError: dlopen(/Users/andrew/miniconda3/envs/dev3/lib/python3.8/site-packages/scipy/optimize/minpack2.cpython-38-darwin.so, 2): Symbol not found: _Py_SET_TYPE
Referenced from: /Users/andrew/miniconda3/envs/dev3/lib/python3.8/site-packages/scipy/optimize/minpack2.cpython-38-darwin.so
Expected in: flat namespace
in /Users/andrew/miniconda3/envs/dev3/lib/python3.8/site-packages/scipy/optimize/minpack2.cpython-38-darwin.so
pip installing the latest release works.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (19 by maintainers)
Looks like we’re all good here. I can’t think of an obvious place to document not to use
so I think we should close this?
This just worked for me without error:
now also work.
What does not work is:
So @peterbell10, your comment is correct. What I didn’t know, and I’m not sure that it’s in the documentation, is that
pip install .
pins the numpy version for building. I was under the impression that it always used the current installed version (if it was recent enough). What is the recommended build/install route if one wants to use the installed version of numpy to build scipy?@mattip,
import numpy
always worked.