1

I use google colab to train may dataset. I uploaded my data set to google drive and recall that from google colab. but running the train.py script imply following errors. more precisely i run:

!python3  /content/drive/tensorflow1/models/research/object_detection/train.py --logtostderr --train_dir=/content/drive/tensorflow1/models/research/object_detection/training/ --pipeline_config_path=/content/drive/tensorflow1/models/research/object_detection/training/faster_rcnn_inception_v2_pets.config

and i get these errores:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/content/drive/tensorflow1/models/research/object_detection/train.py", line 47, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
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_problems

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

Do i need to install or upload Cuda9 or Cudnn to google drive first to address theme on colab? How can i pass these errors?

Farshad
  • 41
  • 1
  • 1
  • 9

3 Answers3

8

Do keep in mind that you have to enable GPU explicitly on a notebook before you could use tensorflow-gpu. I suspect that this step is missing.

In order to enable GPU, try the menu 'runtime->change runtime->hardware accelerator->gpu'

Mark this as solution if that helped so others could benefit.

Adnan Y
  • 2,982
  • 1
  • 26
  • 29
  • Thank you Adnan Y. I solved this issue by installing tensorflow instead of tensorflow-gpu on colab. Although I am not sure if i need to install tensorflow on colab at all. – Farshad May 31 '18 at 03:55
  • You shouldn't have to. Not that it prevents you from installing anything, given it's just a docker container. – Adnan Y May 31 '18 at 04:34
  • I suspect that Farshad already has libcublas in his colab notebook but different version of libcublas. Can figure out with such like this, `find /usr -regex ".*libcublas.*"`. I do have the same issue even though with GPU being used. You can easily reproduce this issue with `pip install tensorflow-gpu`. This issue doens't occur with tensorflow pre-installed. – David Jung Jun 25 '18 at 02:15
  • @Farshad - new to Tensorflow. It makes a sense to me to install tensorflow-gpu since your are using GPU, Why installing tensorflow works in this case? Very confusing. – Nguai al Nov 26 '21 at 16:41
0

Since tensorflow-gpu>=1.5.0 requires CUDA 9, you should install the tensorflow-gpu==1.4.0.
pip install --upgrade tensorflow-gpu==1.4

Please refer to below two links.
https://github.com/tensorflow/tensorflow/issues/15604 https://www.tensorflow.org/install/install_sources#tested_source_configurations

David Jung
  • 376
  • 5
  • 8
  • don't follow your logic. first of all, how did you know what version of CUDA this person is using? Tensorfow version has very sensitive relationship to cuDNN and CUDA version. don't you also need to know cuDNN version as well to recommend which tensoflow-gpu version to use? – Nguai al Dec 10 '21 at 07:51
-1

First, enable GPU on Google Colab Notebook

Go to Menu > Runtime > Change runtime.

Change hardware acceleration to GPU.

How to install CUDA in Google Colab GPU's

Ahwar
  • 1,746
  • 16
  • 30
  • i don't understand how this is allowed since colab has default gpu and its corresponding cuda lib and cudnn lib. if you make changes to this, wouldn't this impact globally since the change takes place /usr/lib level? this simply does not make sense. – Nguai al Dec 10 '21 at 17:51
  • my answer describes how to start a GPU collab instance, I am not telling how to install CUDA. Some people don't know how to get a GPU collab instance so they think that maybe it is a software installation issue but in reality, they have not enabled GPU using google's official method. – Ahwar Dec 10 '21 at 18:19
  • ok. i get that. google collab is doing a terrible job imo rolling out gpu and its corresponding cuda.cudnn lib. i see many cases where it was working yesterday but it stopped working. so code is unchanged but the system lib has changed which is a black box to coders. – Nguai al Dec 10 '21 at 18:30