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
linux version is :Linux version 3.10.0-229.el7.x86_64 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 6 11:36:42 UTC 2015
when I learn python, and import tensorflow,segmentation fault
import tensorflow
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally
Segmentation fault (core dumped)
If I import numpy or matplotlib before tensorflow, it won't crash. If I import tensorflow at the very beginning, it goes to segmentation fault. I guess your "engineers" simply forget to import some libs in this tensorflow release 😆
~/>python3.4
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally
Segmentation fault (core dumped)
~/>python3.4
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import tensorflow
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally
>>>#Everything good
Reacted by thanhnt, onegithuber, Raphaël B, Stefano Pini, Yuwen Yan, xuu and Chenle Li
I've got the same issue with the CPU version: pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
All I have is imports in my test script, and I get the segfault:
# Import libraries for simulation
import tensorflow as tf
import numpy as np
import scipy.ndimage as nd
No errors if I skip import of tensorflow, or if I put it as the final import instead of the first.
I ran it through gdb and got the following backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff2d0e220 in PyArray_API () from /media/local/usr/lib64/python2.7/site-packages/numpy/core/multiarray.so
(gdb) backtrace
#0 0x00007ffff2d0e220 in PyArray_API () from /media/local/usr/lib64/python2.7/site-packages/numpy/core/multiarray.so
#1 0x00007fffe0ed8e54 in _import_array ()
at /opt/_internal/cpython-2.7.11-ucs4/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1633
#2 initspecfun () at build/src.linux-x86_64-2.7/scipy/special/specfunmodule.c:5830
#3 0x00007ffff7b2fc0e in _PyImport_LoadDynamicModule () from /usr/lib64/libpython2.7.so.1.0
#4 0x00007ffff7abf06c in ?? () from /usr/lib64/libpython2.7.so.1.0
#5 0x00007ffff7abf2a4 in ?? () from /usr/lib64/libpython2.7.so.1.0
#6 0x00007ffff7b01756 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.7.so.1.0
#7 0x00007ffff7af276b in ?? () from /usr/lib64/libpython2.7.so.1.0
#8 0x00007ffff7ad96f6 in PyObject_Call () from /usr/lib64/libpython2.7.so.1.0
#9 0x00007ffff7af2c80 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.7.so.1.0
#10 0x00007ffff7af48ed in PyEval_EvalFrameEx () from /usr/lib64/libpython2.7.so.1.0
#11 0x00007ffff7afa33e in PyEval_EvalCodeEx () from /usr/lib64/libpython2.7.so.1.0
#12 0x00007ffff7b27142 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#13 0x00007ffff7b2efb0 in PyImport_ExecCodeModuleEx () from /usr/lib64/libpython2.7.so.1.0
#14 0x00007ffff7b2f1ca in ?? () from /usr/lib64/libpython2.7.so.1.0
#15 0x00007ffff7b0104f in ?? () from /usr/lib64/libpython2.7.so.1.0
#16 0x00007ffff7b018d4 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.7.so.1.0
#17 0x00007ffff7af276b in ?? () from /usr/lib64/libpython2.7.so.1.0
#18 0x00007ffff7ad96f6 in PyObject_Call () from /usr/lib64/libpython2.7.so.1.0
#19 0x00007ffff7af2c80 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.7.so.1.0
#20 0x00007ffff7af48ed in PyEval_EvalFrameEx () from /usr/lib64/libpython2.7.so.1.0
#21 0x00007ffff7afa33e in PyEval_EvalCodeEx () from /usr/lib64/libpython2.7.so.1.0
#22 0x00007ffff7b27142 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#23 0x00007ffff7b2efb0 in PyImport_ExecCodeModuleEx () from /usr/lib64/libpython2.7.so.1.0
#24 0x00007ffff7b2f1ca in ?? () from /usr/lib64/libpython2.7.so.1.0
#25 0x00007ffff7b2f870 in ?? () from /usr/lib64/libpython2.7.so.1.0
#26 0x00007ffff7b0104f in ?? () from /usr/lib64/libpython2.7.so.1.0
#27 0x00007ffff7b01624 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.7.so.1.0
#28 0x00007ffff7af276b in ?? () from /usr/lib64/libpython2.7.so.1.0
#29 0x00007ffff7ad96f6 in PyObject_Call () from /usr/lib64/libpython2.7.so.1.0
#30 0x00007ffff7af2c80 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.7.so.1.0
#31 0x00007ffff7af48ed in PyEval_EvalFrameEx () from /usr/lib64/libpython2.7.so.1.0
#32 0x00007ffff7afa33e in PyEval_EvalCodeEx () from /usr/lib64/libpython2.7.so.1.0
#33 0x00007ffff7b27142 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#34 0x00007ffff7b2efb0 in PyImport_ExecCodeModuleEx () from /usr/lib64/libpython2.7.so.1.0
#35 0x00007ffff7b2f1ca in ?? () from /usr/lib64/libpython2.7.so.1.0
#36 0x00007ffff7b2f870 in ?? () from /usr/lib64/libpython2.7.so.1.0
#37 0x00007ffff7b0104f in ?? () from /usr/lib64/libpython2.7.so.1.0
#38 0x00007ffff7b01624 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.7.so.1.0
#39 0x00007ffff7af276b in ?? () from /usr/lib64/libpython2.7.so.1.0
#40 0x00007ffff7ad96f6 in PyObject_Call () from /usr/lib64/libpython2.7.so.1.0
#41 0x00007ffff7af2c80 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.7.so.1.0
#42 0x00007ffff7af48ed in PyEval_EvalFrameEx () from /usr/lib64/libpython2.7.so.1.0
#43 0x00007ffff7afa33e in PyEval_EvalCodeEx () from /usr/lib64/libpython2.7.so.1.0
#44 0x00007ffff7b27142 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#45 0x00007ffff7b2efb0 in PyImport_ExecCodeModuleEx () from /usr/lib64/libpython2.7.so.1.0
#46 0x00007ffff7b2f1ca in ?? () from /usr/lib64/libpython2.7.so.1.0
#47 0x00007ffff7b0104f in ?? () from /usr/lib64/libpython2.7.so.1.0
#48 0x00007ffff7b018d4 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.7.so.1.0
#49 0x00007ffff7af276b in ?? () from /usr/lib64/libpython2.7.so.1.0
#50 0x00007ffff7ad96f6 in PyObject_Call () from /usr/lib64/libpython2.7.so.1.0
#51 0x00007ffff7af2c80 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.7.so.1.0
#52 0x00007ffff7af48ed in PyEval_EvalFrameEx () from /usr/lib64/libpython2.7.so.1.0
#53 0x00007ffff7afa33e in PyEval_EvalCodeEx () from /usr/lib64/libpython2.7.so.1.0
#54 0x00007ffff7b27142 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#55 0x00007ffff7b2efb0 in PyImport_ExecCodeModuleEx () from /usr/lib64/libpython2.7.so.1.0
#56 0x00007ffff7b2f1ca in ?? () from /usr/lib64/libpython2.7.so.1.0
#57 0x00007ffff7b2f870 in ?? () from /usr/lib64/libpython2.7.so.1.0
#58 0x00007ffff7b0104f in ?? () from /usr/lib64/libpython2.7.so.1.0
#59 0x00007ffff7b01624 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.7.so.1.0
#60 0x00007ffff7af276b in ?? () from /usr/lib64/libpython2.7.so.1.0
#61 0x00007ffff7ad96f6 in PyObject_Call () from /usr/lib64/libpython2.7.so.1.0
#62 0x00007ffff7af2c80 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.7.so.1.0
#63 0x00007ffff7af48ed in PyEval_EvalFrameEx () from /usr/lib64/libpython2.7.so.1.0
#64 0x00007ffff7afa33e in PyEval_EvalCodeEx () from /usr/lib64/libpython2.7.so.1.0
#65 0x00007ffff7b27142 in PyEval_EvalCode () from /usr/lib64/libpython2.7.so.1.0
#66 0x00007ffff7b338ad in ?? () from /usr/lib64/libpython2.7.so.1.0
#67 0x00007ffff7ac16ad in PyRun_FileExFlags () from /usr/lib64/libpython2.7.so.1.0
#68 0x00007ffff7ac2294 in PyRun_SimpleFileExFlags () from /usr/lib64/libpython2.7.so.1.0
#69 0x00007ffff7ac9e63 in Py_Main () from /usr/lib64/libpython2.7.so.1.0
#70 0x00007ffff7488b05 in __libc_start_main () from /lib64/libc.so.6
#71 0x000000000040078e in _start ()
(gdb)
It looks like it's got enhanced with some logic which I don't fully understand. @girving -- do you see any scenarios where "import_array()" isn't going to run?
@tmsimont: I'm confused by your stacktrace. Why is scipy involved? Is it possible to get a reproduction case that doesn't involve scipy being the culprit?
Ah, looks like there a few tests that do touch scipy, including one broken one that requires it or fails. I will get the culprit to fix that one, but it's unrelated to this issue.
import tensorflow as tf
import scipy.ndimage as nd
However, this does not fail:
import tensorflow as tf
import scipy
So it seems there is something in scipy.ndimage that causes a segmentation fault after tensorflow is loaded.
This does not fail
import scipy.ndimage as nd
import tensorflow as tf
Also -- FYI, I'm using scipy here as this comes from the Mandlebrot example
After running some more tests and comparing my issue to the OP I'm afraid I may have a different problem than what others in this thread have encountered.
@mouendless, @chengdianxuezi and @zhang8473 all seem to have a problem with just the single import tensorflow include. I apparently only have the issue when scipy.ndimage is imported after tensorflow...
@amineHorseman Are you sure you have the latest version (print(tensorflow.__version__))?
For me, it works. I can now import tf without importing np before.
@MartinThoma yes, I'm sure about the version.
I installed tensorflow-0.9.0rc0 from source in conda environment and uninstalled the older version. The current configuration is: python 2.7.11, cuda 7.5, cudnn 5, OS X 11.10.5.
EDIT: importing numpy or not didn't fix the problem
@amineHorseman If importing numpy doesn't fix it, please file a different issue. It is probably unrelated, unless you have reason to believe otherwise.
For everyone using RHEL/Centos 6.x, you might have to build tensorflow from source by installing bazel first.
Here's how I got past this issue on RHEL 6.8:
cd /tmp/tensorflow_pkg
pip install --upgrade tensorflow-0.10.0-cp27-none-linux_x86_64.whl
9) Test tensorflow
python2.7
Python 2.7.12 (default, Jun 28 2016, 17:49:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
exit()
How to solve the similar problem as follow, I try to upgrade matplotlib and so on, but they are failed.
[llliao@GPU-1-10 ~]$ python3
Python 3.5.4 (default, Aug 8 2017, 11:09:21)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf
sess=tf.Session()
2018-01-13 20:00:56.735985: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-01-13 20:00:57.053726: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
pciBusID: 0000:04:00.0
totalMemory: 11.17GiB freeMemory: 4.29GiB
2018-01-13 20:00:57.350308: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 1 with properties:
name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
pciBusID: 0000:05:00.0
totalMemory: 11.17GiB freeMemory: 2.58GiB
2018-01-13 20:00:57.658419: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 2 with properties:
name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
pciBusID: 0000:83:00.0
totalMemory: 11.17GiB freeMemory: 6.35GiB
Segmentation fault (core dumped)
Activity
prb12 commentedon Apr 20, 2016
Hi,
Could you please provide a little more information:
What is the hardware configuration of your machine and what versions of the NVIDIA software do you have installed?
Thanks,
Paul
zhang8473 commentedon Apr 21, 2016
I got the same problem under:
Cuda: /usr/local/cuda-7.5/
GPU: NVIDIA Geforce GTX 970M
CUDNN: cudnn-7.0-linux-x64-v4.0-prod.tgz
Linux: 4.2.0-30-generic #35-Ubuntu
If I import numpy or matplotlib before tensorflow, it won't crash. If I import tensorflow at the very beginning, it goes to segmentation fault. I guess your "engineers" simply forget to import some libs in this tensorflow release 😆
mouendless commentedon Apr 21, 2016
Yes I've got the same problem, and as @zhang8473 said, if I import numpy and matplotlib first, it won't crash.
And I'm using the version without GPU
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
fxia22 commentedon Apr 22, 2016
same problem here
CUDA 7.5 with CUDNN V5(build 5004)
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
tmsimont commentedon Apr 22, 2016
I've got the same issue with the CPU version:
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whlAll I have is imports in my test script, and I get the segfault:
No errors if I skip import of tensorflow, or if I put it as the final import instead of the first.
I ran it through gdb and got the following backtrace:
The issue seems very similar to one that used to exist in numpy
tmsimont commentedon Apr 25, 2016
I'm looking into this further and there seems to be a known issue related to this somehow in the tf_session_helper.h
Note the error check: Numpy cannot be included before tf_session_helper.h
Could be that we need something similar for
#ifdef PyArray_APItmsimont commentedon Apr 25, 2016
Oh wait.. the problem appears if we put TensorFlow before numpy... maybe not it
yaroslavvb commentedon Apr 25, 2016
The error sounds like "import_array" is not getting run. That's a function that sets up some global state and must be run before using numpy C API.
We used to have the following in tf_session.i
It looks like it's got enhanced with some logic which I don't fully understand. @girving -- do you see any scenarios where "import_array()" isn't going to run?
girving commentedon Apr 25, 2016
@tmsimont: I'm confused by your stacktrace. Why is scipy involved? Is it possible to get a reproduction case that doesn't involve scipy being the culprit?
girving commentedon Apr 25, 2016
Ah, looks like there a few tests that do touch scipy, including one broken one that requires it or fails. I will get the culprit to fix that one, but it's unrelated to this issue.
tmsimont commentedon Apr 25, 2016
It seems that in my case it wasn't just numpy...
This works:
This fails
However, this does not fail:
So it seems there is something in
scipy.ndimagethat causes a segmentation fault after tensorflow is loaded.This does not fail
Also -- FYI, I'm using scipy here as this comes from the Mandlebrot example
After running some more tests and comparing my issue to the OP I'm afraid I may have a different problem than what others in this thread have encountered.
@mouendless, @chengdianxuezi and @zhang8473 all seem to have a problem with just the single
import tensorflowinclude. I apparently only have the issue when scipy.ndimage is imported after tensorflow...girving commentedon Apr 26, 2016
@vrv or @martinwicke: Do you know what version of numpy we're building against?
@chengdianxuezi, @mouendless, @fxia22: What versions of numpy do you have?
If these versions don't match, numpy might decide to crash.
vrv commentedon Apr 26, 2016
@caisq for pip build info
fxia22 commentedon Apr 26, 2016
@girving I am using
numpy==1.11.053 remaining items
bug-fixed commentedon May 23, 2016
@gladys0313 , I can't remember the details. Maybe after some googling, and got some hints. And then I tried, then it worked.
apkuhar commentedon May 24, 2016
Confirming that importing numpy before tensorflow fixes it. (ok, it's more of a workaround than a fix)
For me it started seg faulting after I installed scipy in an otherwise clean virtualenv on Ubuntu 15.04.
davebs commentedon May 29, 2016
In my case,
pip install scikit-imagefixed it.martinwicke commentedon May 29, 2016
Probably because that updated scipy or numpy as a side effect.
On Sat, May 28, 2016 at 20:59 davebs [email protected] wrote:
prhbrt commentedon May 29, 2016
A quick-fix for this might be to install version 0.7:
or any other version found here: https://storage.googleapis.com/tensorflow/
This worked for me, that is on 0.8.0
python3 -c 'import tensorflow'resulted in a segmentation fault, whereas 0.7.1 did not.girving commentedon Jun 7, 2016
For anyone who finds this thread: TensorFlow 0.9 has the workaround.
amineHorseman commentedon Jun 9, 2016
Actually, I have the same issue in Tensorflow 0.9 👎
MartinThoma commentedon Jun 9, 2016
@amineHorseman Are you sure you have the latest version (
print(tensorflow.__version__))?For me, it works. I can now import tf without importing np before.
amineHorseman commentedon Jun 9, 2016
@MartinThoma yes, I'm sure about the version.
I installed tensorflow-0.9.0rc0 from source in conda environment and uninstalled the older version. The current configuration is: python 2.7.11, cuda 7.5, cudnn 5, OS X 11.10.5.
EDIT: importing numpy or not didn't fix the problem
girving commentedon Jun 9, 2016
@amineHorseman If importing numpy doesn't fix it, please file a different issue. It is probably unrelated, unless you have reason to believe otherwise.
countkisg commentedon Jul 19, 2016
Is there any update now? I found there was no such problem in pyCharm IDE (with sklearn installed)
But the same code cann't work in ipython, Dont know why
varundmishra commentedon Nov 29, 2016
For everyone using RHEL/Centos 6.x, you might have to build tensorflow from source by installing bazel first.
Here's how I got past this issue on RHEL 6.8:
TensorFlow (Installation on RHEL/Centos 6.x):
1) Enable Repos for Installing python2.7
CentOS 6
yum install centos-release-scl-rhRHEL 6
yum-config-manager --enable rhel-server-rhscl-6-rpmsInstall Software Collections in Scientific Linux 6Shell
yum install "http://ftp.scientificlinux.org/linux/scientific/6/external_products/softwarecollections/yum-conf-softwarecollections-1.0-1.el6.noarch.rpm"Set
gpgcheck=0in /etc/yum.repos.d/softwarecollections.repo2) Install python2.7
yum install python27 python27-numpy swig python27-python-devel python27-python-wheel python27-pip3) Install Developer Toolset
yum install devtoolset-44) Build and Install Bazel
Enter Software Collection environment with Developer Toolset.
scl enable devtoolset-4 bashPrepare Source Code
clone source code repository
select version
git checkout 0.3.1Build and Install
compile
./compile.shinstall
exit from Software Collection environment
exit5) Build TensorFlow with Bazel
Enter Build Environment
scl enable devtoolset-4 python27 bashPrepare Source Code
clone source code repository
select version
git checkout v0.10.06) Since GNU C library version in CentOS 6 is less than 2.17, a slight modification needs to be applied before compilation.
Modify tf_extension_linkopts function in tensorflow/tensorflow.bzl FROM
TO
7) Build
configure workspace, just leave everything as default
./configurebuild
exit from Software Collection environment
exit8) Install tensorflow via pip_package
9) Test tensorflow
Hope this helps!!!
ryuseonghan commentedon Apr 14, 2017
I had a similar problem. And I've solved that problem by upgrading matplotlib.
sudo pip install --upgrade matplotlibTaihuLight commentedon Jan 13, 2018
How to solve the similar problem as follow, I try to upgrade matplotlib and so on, but they are failed.
[llliao@GPU-1-10 ~]$ python3
Python 3.5.4 (default, Aug 8 2017, 11:09:21)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Merge pull request tensorflow#2034 from ROCmSoftwarePlatform/develop-…