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.
Please help me find the reason,thanks a lot.
Where did you get numpy? BTW, questions like this should be asked on the mailing list, github issues is for bugs
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_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
:
@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?
Hi njsmith,
Thanks for your information,this issue is resolved.
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.
import fpectl
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named fpectl
Most helpful comment
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_HANDLER
inpyconfig.h
), thenPyFPE_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
:@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?