You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
When I write:"from numpy import *" from code and execute the code,then meet the following error:
Traceback (most recent call last):
File "rgbtoyuv.py", line 2, in
import numpy as np
File "/usr/local/lib/python3.5/site-packages/numpy-1.11.2-py3.5-linux-x86_64.egg/numpy/init.py", line 163, in
from . import random
File "/usr/local/lib/python3.5/site-packages/numpy-1.11.2-py3.5-linux-x86_64.egg/numpy/random/init.py", line 99, in
from .mtrand import *
ImportError: /usr/local/lib/python3.5/site-packages/numpy-1.11.2-py3.5-linux-x86_64.egg/numpy/random/mtrand.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyFPE_jbuf
Platform ubuntu16.04 x86_64
python version: 3.5.2
numpy version:1.11.2 and try to version:1.9.0 also,but installed failed.
CPython has some optional code for catching SIGFPE and converting it into an exception. To use it, you wrap C-level floating point computations in PyFPE_START_PROTECT/PyFPE_END_PROTECT. If CPython was compiled with --with-fpectl (which corresponds to having a #define WANT_SIGFPE_HANDLER in pyconfig.h), then PyFPE_jbuf is exported as a global symbol, and these macros expand into some clever stuff that references this symbol. If CPython was compiled without --with-fpectl, then the symbol isn't exported and the macros become no-ops. So this means that CPython actually has a different, incompatible ABI depending on whether it was compiled with or without --with-fpectl. Joy.
(It looks like you can check which sort of CPython you have by doing import fpectl -- if this succeeds then you have a --with-fpectl CPython.)
Numpy itself doesn't use these macros. But Cython autogenerated code does use them.
Conclusion: if you compile a Cython module using a CPython that was built with --with-fpectl, then it will crash when you try to run it on a CPython that was built without --with-fpectl.
Quick checking of some common linux CPython builds to see which ones use --with-fpectl:
Manylinux: no
Current Debian testing: yes
Ubuntu 12.04: yes
Ubuntu 16.04: yes
Conda: no (checked 2.7 and 3.5)
Fedora 25: no
@kevinzhai80: Did you by some chance build numpy from source for some reason, using the Ubuntu-installed Python, and then try to import it from a conda-installed Python?
Reacted by Maximilian Wurm, Robert Lucian Chiriac, dentistofdoom, Changbin Liu, Khanagha A., Tiantian.W, zhengdi, NotSqrt, 九条涼果, DDD and 1 more
Activity
charris commentedon Dec 24, 2016
Where did you get numpy? BTW, questions like this should be asked on the mailing list, github issues is for bugs
njsmith commentedon Dec 24, 2016
Seems like a bug report to me?
Some clues as to what's going on here:
CPython has some optional code for catching SIGFPE and converting it into an exception. To use it, you wrap C-level floating point computations in
PyFPE_START_PROTECT/PyFPE_END_PROTECT. If CPython was compiled with--with-fpectl(which corresponds to having a#define WANT_SIGFPE_HANDLERinpyconfig.h), thenPyFPE_jbufis exported as a global symbol, and these macros expand into some clever stuff that references this symbol. If CPython was compiled without--with-fpectl, then the symbol isn't exported and the macros become no-ops. So this means that CPython actually has a different, incompatible ABI depending on whether it was compiled with or without--with-fpectl. Joy.(It looks like you can check which sort of CPython you have by doing
import fpectl-- if this succeeds then you have a--with-fpectlCPython.)Numpy itself doesn't use these macros. But Cython autogenerated code does use them.
Conclusion: if you compile a Cython module using a CPython that was built with
--with-fpectl, then it will crash when you try to run it on a CPython that was built without--with-fpectl.Quick checking of some common linux CPython builds to see which ones use
--with-fpectl:@kevinzhai80: Did you by some chance build numpy from source for some reason, using the Ubuntu-installed Python, and then try to import it from a conda-installed Python?
kevinzhai80 commentedon Dec 25, 2016
Hi njsmith,
Thanks for your information,this issue is resolved.
smorrel1 commentedon Jan 11, 2018
Thanks njsmith. Also: Ubuntu 17.10 Artful no. Upgrading caused the error:
$ python
Python 2.7.14 (default, Sep 23 2017, 22:06:14)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.