Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AyushM
Beginner
70 Views

Tensorflow import error-Failed to map segment from shared object

I'm getting an error when I try to run a python file which imports tensorflow.The conda env is already active.I'm following the steps from this link:https://devcloud.intel.com/oneapi/get_started/aiAnalyticsToolkitSamples/

This is the error:

(base) u61707@login-2:~/oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelTensorFlow_GettingStarted$ #!/bin/
bash
(base) u61707@login-2:~/oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelTensorFlow_GettingStarted$ source
/opt/intel/inteloneapi/setvars.sh > /dev/null 2>&1
(base) u61707@login-2:~/oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelTensorFlow_GettingStarted$ source
activate tensorflow
(tensorflow) u61707@login-2:~/oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelTensorFlow_GettingStarted$ p
ython TensorFlow_HelloWorld.py
Traceback (most recent call last):
File "TensorFlow_HelloWorld.py", line 11, in <module>
import tensorflow.compat.v1 as tf
File "/glob/development-tools/versions/oneapi/gold/inteloneapi/intelpython/latest/envs/tensorflow/lib/python3.7/site-packages/tensorflow/__init__.py", line 41, in <mo
dule>
from tensorflow.python.tools import module_util as _module_util
File "/glob/development-tools/versions/oneapi/gold/inteloneapi/intelpython/latest/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 64,
in <module>
from tensorflow.python.framework.framework_lib import * # pylint: disable=redefined-builtin
File "/glob/development-tools/versions/oneapi/gold/inteloneapi/intelpython/latest/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/framework_li
b.py", line 25, in <module>
from tensorflow.python.framework.ops import Graph
File "/glob/development-tools/versions/oneapi/gold/inteloneapi/intelpython/latest/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", lin
e 54, in <module>
from tensorflow.python.framework import dtypes
File "/glob/development-tools/versions/oneapi/gold/inteloneapi/intelpython/latest/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py",
line 28, in <module>
from tensorflow.python import _pywrap_bfloat16
ImportError: /glob/development-tools/versions/oneapi/gold/inteloneapi/intelpython/latest/envs/tensorflow/lib/python3.7/site-packages/tensorflow/python/_pywrap_bfloat16.
so: failed to map segment from shared object

 

Please let me know how to resolve this.

Thanks.

0 Kudos
2 Replies
RaeesaM_Intel
Moderator
52 Views

Hi Ayush,

Thank you for posting in Intel devcloud Forum.

 

The error is because you are in devcloud login node and trying to execute the commands in script file hello-world.sh separately. You have to be in compute node to be able to perform your tasks. You could reach an interactive compute node by using the below command, once you are connected to devcloud.

$qsub -I

-I (upper case i) is the argument used to request an interactive session.

Once you are in your compute node, the steps should work fine without any issues.

$cd ~/oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelTensorFlow_GettingStarted
$source /opt/intel/inteloneapi/setvars.sh > /dev/null 2>&1
$source activate tensorflow
$python TensorFlow_HelloWorld.py

Or follow the same steps as given in the tutorial link, by creating hello-world.sh file and then submitting it as a job. It should work fine in that case also and you will get output as :

Tensorflow HelloWorld Done!

[CODE_SAMPLE_COMPLETED_SUCCESFULLY]

To know more about login node and compute node , refer the following link : https://community.intel.com/t5/Intel-DevCloud/Login-Node-Versus-Compute-Node-in-Intel-DevCloud/m-p/1...

Hope this helps.

 

Regards,

Raeesa

RaeesaM_Intel
Moderator
22 Views

Hi Ayush,


Is your issue resolved ? Are you able to run the script without any errors ?Please let us know the updates.


Raeesa