简体   繁体   中英

“Failed to load the native TensorFlow runtime.” error when importing tensorflow with rocm

I'm interested in learning tensorflow with pycharm for a few projects with an amd system (r5 3600x, rx 5700xt). After realizing I was only going to get this to work with my gpu if I installed linux, I installed ubuntu 18.04 to dualboot with Windows 10, since it looked like the most supported for rocm. I followed the tutorial here, except I didn't make the virtual environment. https://www.videogames.ai/Install-ROCM-Machine-Learning-AMD-GPU When typing in sudo apt install rocm-libs miopen-hip cxlactivitylogger it said it couldn't find the package cxlactivitylogger, in the comments the author said he would look into it but it wasnt necessary to install tensorflow, so I ignored it. I then opened up pycharm, the tensorflow package wouldn't detect so I installed tensorflow-rocm again in pycharm just to make sure, but it gives me this error whenever I try to import it in pycharm or in the terminal.

    Traceback (most recent call last):
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/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: librccl.so.1: 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 "/home/waiai/PycharmProjects/app/main.py", line 1, in <module>
    import tensorflow
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow/__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow/__init__.py", line 50, in __getattr__
    module = self._load()
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow/__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/waiai/PycharmProjects/app/venv/lib/python3.6/site-packages/tensorflow_core/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: librccl.so.1: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

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

I'm fairy inexperienced with linux, so all of this has just given me a headache, I've tried installing pytorch before this, but I was getting similar errors so I decided to try tensorflow. If anyone can bother to hold my hand through this it would be greatly appretiated, thanks in advance.

Fixed, I installed rccl with

sudo apt install rccl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM