# Buggy code
def run(self, dry=False):
    if self.locked:
        msg = "Verifying outputs in locked stage '{}'"
        self.project.logger.info(msg.format(self.relpath))
        if not dry:
            self.check_missing_outputs()
    elif self.is_import:
        msg = "Importing '{}' -> '{}'"
        self.project.logger.info(msg.format(self.deps[0].path, self.outs[0].path))

        if not dry:
            self.deps[0].download(self.outs[0].path_info)
    elif self.is_data_source:
        msg = "Verifying data sources in '{}'".format(self.relpath)
        self.project.logger.info(msg)
        if not dry:
            self.check_missing_outputs()
    else:
        msg = "Running command:\n\t{}".format(self.cmd)
        self.project.logger.info(msg)

        if not dry:
            p = subprocess.Popen(
                self.cmd,
                cwd=self.cwd,
                shell=True,
                env=os.environ,
                executable=os.getenv("SHELL"),
            )
            p.communicate()
            if p.returncode != 0:
                raise StageCmdFailedError(self)

    if not dry:
        self.save()


# Traceback (ImportError)
Running command:
python3 test.py
/bin/bash: /tmp/_MEIACeYFM/libtinfo.so.5: no version information available (required by /bin/bash)
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/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.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /tmp/_MEIACeYFM/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import tensorflow as tf
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/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.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/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.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /tmp/_MEIACeYFM/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so)


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.
Failed to run command: Stage 'Dvcfile' cmd python3 test.py failed

# Fixed code
def run(self, dry=False):
    if self.locked:
        msg = "Verifying outputs in locked stage '{}'"
        self.project.logger.info(msg.format(self.relpath))
        if not dry:
            self.check_missing_outputs()
    elif self.is_import:
        msg = "Importing '{}' -> '{}'"
        self.project.logger.info(msg.format(self.deps[0].path, self.outs[0].path))

        if not dry:
            self.deps[0].download(self.outs[0].path_info)
    elif self.is_data_source:
        msg = "Verifying data sources in '{}'".format(self.relpath)
        self.project.logger.info(msg)
        if not dry:
            self.check_missing_outputs()
    else:
        msg = "Running command:\n\t{}".format(self.cmd)
        self.project.logger.info(msg)

        if not dry:
            p = subprocess.Popen(
                self.cmd,
                cwd=self.cwd,
                shell=True,
                env=fix_env(os.environ),
                executable=os.getenv("SHELL"),
            )
            p.communicate()
            if p.returncode != 0:
                raise StageCmdFailedError(self)

    if not dry:
        self.save()