question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

minpack2.cpython-38-darwin.so, 2): Symbol not found: _Py_SET_TYPE

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
rgommerscommented, Feb 6, 2021

Looks like we’re all good here. I can’t think of an obvious place to document not to use

python setup.py build
pip install .

so I think we should close this?

1reaction
andyfaffcommented, Aug 10, 2020

This just worked for me without error:

(base) $ conda create -n dev38 python=3.8
(dev38) $ conda activate dev38
(dev38) $ python --version
Python 3.8.5

(dev38) $ git clean -xdf
(dev38) $ pip install cython numpy pybind11

Collecting numpy
  Using cached numpy-1.19.1-cp38-cp38-macosx_10_9_x86_64.whl (15.3 MB)
Collecting cython
  Using cached Cython-0.29.21-cp38-cp38-macosx_10_9_x86_64.whl (1.9 MB)
Collecting pybind11
  Using cached pybind11-2.5.0-py2.py3-none-any.whl (296 kB)
Installing collected packages: numpy, cython, pybind11
Successfully installed cython-0.29.21 numpy-1.19.1 pybind11-2.5.0

(dev38) $ pip install .
Processing /Users/andrew/Documents/Andy/programming/scipy
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: scipy
  Building wheel for scipy (PEP 517) ... done
  Created wheel for scipy: filename=scipy-1.6.0.dev0+96caa9d-cp38-cp38-macosx_10_9_x86_64.whl size=18749869 sha256=a60d81519364b81b2900dcaf130a96278794b55833ce566654eec67d48fbfedb
  Stored in directory: /private/var/folders/m8/gwtcncws12jf60xw5n6knwnw0000gn/T/pip-ephem-wheel-cache-zmin2im9/wheels/dd/e2/ce/5e25e40098d319817f14448037967682ebcd7efcbb8c9ded4c
Successfully built scipy
Installing collected packages: scipy
Successfully installed scipy-1.6.0.dev0+96caa9d


(dev38) $ cd ..
(dev38) $ python
Python 3.8.5 (default, Aug  5 2020, 03:39:04) 
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import scipy.stats
>>> exit()
python setup.py build; python setup.py develop

now also work.

What does not work is:

python setup.py build
pip install .

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can this reticulate/scipy problem be fixed? - Stack Overflow
Looking at the error you obtain, i wander what does your computer say if you try to run the same import statement from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found