Forums - Error in running inception_setup.py

7 posts / 0 new
Last post
Error in running inception_setup.py
amirajaee
Join Date: 31 Jul 18
Posts: 14
Posted: Thu, 2018-08-23 20:09

Hi,

when I run inception stup python script, i see the following error:

>>>>>>>>>>>>>>>>>>>>>>>

amir@aceslab:~/snpe-1.18.0/models/inception_v3/scripts$ python setup_inceptionv3.py -a ./temp-assests.cache -d
Traceback (most recent call last):
  File "setup_inceptionv3.py", line 10, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_p...

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

 

  • Up0
  • Down0
jihoonk
Profile picture
Join Date: 28 Jan 13
Location: Seoul
Posts: 55
Posted: Thu, 2018-08-23 21:55

Hi amirajaee,

Does your enviornment have CUDA installed?

If so, try setting environment variable for CUDA.

 

 export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:$LD_LIBRARY_PATH

 

Thanks,

Jihoon

  • Up0
  • Down0
amirajaee
Join Date: 31 Jul 18
Posts: 14
Posted: Sat, 2018-08-25 12:17

Thanks Jihoon,

i've installed CUDA:

LAB:~/snpe-1.18.0/models/inception_v3/scripts$ nvcc --versionnvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Wed_Jul_17_18:36:13_PDT_2013
Cuda compilation tools, release 5.5, V5.5.0

but I still see this error:

LAB:~/snpe-1.18.0/models/inception_v3/scripts$ python setup_inceptionv3.py
Traceback (most recent call last):
  File "setup_inceptionv3.py", line 10, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_p...

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
 

  • Up0
  • Down0
amirajaee
Join Date: 31 Jul 18
Posts: 14
Posted: Sat, 2018-08-25 12:39

Actually the issue was that my tensorflow (1.8) is aksing fur CUDA 9 and in NVIDIA page, there is no CUDA 9 for ubuntu 7.14!

So I downgraded to tensorflow 1.0 and it's working fine with CUDA 8 exisiting on my system,

Now it's asking for arguments. What arguments should I use?

LAB:~/snpe-1.18.0/models/inception_v3/scripts$ python setup_inceptionv3.py
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
usage: setup_inceptionv3.py [-h] -a ASSETS_DIR [-d]
setup_inceptionv3.py: error: argument -a/--assets_dir is required

Also, when i run:

LAB:~/snpe-1.18.0$ python ./models/inception_v3/scripts/setup_inceptionv3.py -a ./temp-assets-cache -d

I see the following error. (I have installed android sdk/ndk):

ERROR: SNPE_ROOT not setup.  Please run the SDK env setup script.

I do not see such a script (environment-setup or like that) in android sdk path!

 

  • Up0
  • Down0
howardd
Join Date: 3 Nov 17
Posts: 5
Posted: Mon, 2018-08-27 09:34

Hi amirajaee,

Please find the SNPE environment setup instructions at https://developer.qualcomm.com/docs/snpe/setup.html. I believe the heading "Environment setup for TensorFlow" contains the instructions you're looking for.

Regards,

David

  • Up0
  • Down0
amirajaee
Join Date: 31 Jul 18
Posts: 14
Posted: Mon, 2018-08-27 20:57

Thanks David,

I have already followed the setup instructions. Here is the log for running it:

LAB:~/snpe-1.18.0$ source bin/envsetup.sh -t /usr/local/lib/python2.7/dist-packages/tensorflow/
[INFO] Setting TENSORFLOW_HOME=/usr/local/lib/python2.7/dist-packages/tensorflow/
[WARNING] Can't find ANDROID_NDK_ROOT or ndk-build. SNPE needs android ndk to build the NativeCppExample  >> I have it installed though!
[INFO] Found /home/amir/snpe-1.18.0/lib/arm-android-gcc4.9/libgnustl_shared.so
[INFO] Adding armeabi-v7a libgnustl_shared.so to /home/amir/snpe-1.18.0/android/snpe-gcc-release.aar
[INFO] Found /home/amir/snpe-1.18.0/lib/aarch64-android-gcc4.9/libgnustl_shared.so
[INFO] Adding arm64-v8a libgnustl_shared.so to /home/amir/snpe-1.18.0/android/snpe-gcc-release.aar
 

but I still see the error. Can someone tell me what the misisng argument is here?

amir@aceslab:~/snpe-1.18.0/models/inception_v3/scripts$ python setup_inceptionv3.py
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
usage: setup_inceptionv3.py [-h] -a ASSETS_DIR [-d]
setup_inceptionv3.py: error: argument -a/--assets_dir is required
 

there is nothing else mentioned in setup page:

Environment setup for TensorFlow

  • Using the SNPE SDK with TensorFlow models requires a valid TensorFlow installation (see TensorFlow Setup.)
  • Go to $SNPE_ROOT and run the following script to setup the SNPE SDK environment. The location of the TensorFlow directory must be provided.
    source bin/envsetup.sh -t $TENSORFLOW_DIR 
    
           where $TENSORFLOW_DIR is the path to the TensorFlow installation.
    
  • The script sets up the following environment variables.
      SNPE_ROOT: root directory of the SNPE SDK installation
      TENSORFLOW_HOME: root directory of the TensorFlow installation provided
    
  • The script also updates PATH, LD_LIBRARY_PATH, and PYTHONPATH.
  • Up0
  • Down0
amirajaee
Join Date: 31 Jul 18
Posts: 14
Posted: Mon, 2018-08-27 21:16

used -a ./temp-assets-cache -d after my command and setup is completed :)

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.