Issue with TensorFlow V2.0 &

I had adapted (renamed as and wrapped it with a Flask server which serves my other language pairs on This provided a practical way of serving predictions from TF V2. This was working OK, but after installing the latest version of TensorFlow I am getting a Fatal Python error:

Source: My friend lives in Istanbul (from command line version).
Fatal Python error: Segmentation fault (no prediction delivered)

Thread 0x00007f2d83cb6700 (most recent call first):
File “/home/miguel/tf2_env/lib/python3.5/site-packages/tensorflow_core/python/eager/”, line 61 in quick_execute
File “/home/miguel/tf2_env/lib/python3.5/site-packages/tensorflow_core/python/eager/”, line 545 in call
File “/home/miguel/tf2_env/lib/python3.5/site-packages/tensorflow_core/python/eager/”, line 1692 in _call_flat
File “/home/miguel/tf2_env/lib/python3.5/site-packages/tensorflow_core/python/saved_model/”, line 99 in _call_flat
File “/home/miguel/tf2_env/lib/python3.5/site-packages/tensorflow_core/python/eager/”, line 1591 in _call_impl
File “/home/miguel/tf2_env/lib/python3.5/site-packages/tensorflow_core/python/eager/”, line 1551 in call
File “./”, line 21 in translate
File “./”, line 61 in main
File “./”, line 67 in
Segmentation fault

The code in line 61 mentioned above is:
device_name = ctx.device_name

pylint: disable=protected-access

tensors = pywrap_tensorflow.TFE_Py_Execute(ctx._handle, device_name,
op_name, inputs, attrs,
except core._NotOkStatusException as e:
if name is not None:
message = e.message + " name: " + name

The relevant code snippet in ( is:
def translate(self, texts):
“”“Translates a batch of texts.”""
inputs = self._preprocess(texts)
outputs = self._translate_fn(**inputs) <-----------
return self._postprocess(outputs)

I am puzzled as this was all working fine until I installed the latest version of TensorFlow after noticing that it was not always detecting my GPU.
The GPU is detected by TensorFlow 1.4 OpenNMT-tf V 1.x) which I have running in a separate environment and nvidia-smi shows no issues.

The latest TensorFlow version (2.1) requires CUDA 10.1. Is everything setup correctly?

If yes, you might need to post a code snippet to reproduce the issue.

Ah, CUDA 10.1 is in /usr/local but NOT in $PATH. Will add in the morning and see what happens Thnx for quick response.

Hi Guillaume, Putting CUDA 10.1 in the path got me on the right path! However I did remove TensorFlow 2.1 and go back to TensorFlow 2.0 as that seems to have less issues. The changed to my module now works OK without a segmentation fault and will go back into the Flask server. Thanks again from your quick response.