2

I have a Python script (some simple binary classification based on a multilayer perceptron) which uses Keras running on Tensorflow backend and runs correctly on my laptop on Windows, but produces the following errors while I run it on Ubuntu virtual machine from Google Cloud. Any ideas on how to fix this? I would be thankful for any suggestions. Ubuntu info: Ubuntu 16.04.5 LTS (GNU/Linux 4.15.0-1027-gcp x86_64) Tensorflow is 1.13.1 Keras is 2.2.4

2019-02-26 23:14:29.217591: I 
tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports 
instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

2019-02-26 23:14:29.224424: I 
tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 
2300000000 Hz

2019-02-26 23:14:29.225784: I 
tensorflow/compiler/xla/service/service.cc:150] XLA service 0x384e6a0 
executing computations on platform Host. Devices:

2019-02-26 23:14:29.225824: I 
tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): 
<undefined>, <undefined>

Update: the actual error is as follows.

Exception ignored in: <bound method BaseSession.__del__ of 
<tensorflow.python.client.session.Session object at 0x7fe9
23271400>>
Traceback (most recent call last):
File "/home/berezutskii/.local/lib/python3.5/site- 
packages/tensorflow/python/client/session.py", line 738, in __del__
TypeError: 'NoneType' object is not callable

Update: solved by reinstalling tensorflow using admin rights.

1 Answers1

1

These are not errors this is just the way of tensorflow to tell you that this cpu support higher level implementation and you can install tensorflow to use those features. By default tensorflow installs with basic features in all machines regardless of what they are capable of.

You can build tensorflow from source in order to use these features instead of the usual pip install which as mentioned only install the basic version so that it can run on most of the machines. Details on the same can be found here

The error you have updated is a known issue happens inconsistently primarily with keras there are two things that seems to fix this:

One is simply importing:

import tensorflow.contrib.keras as keras 

However a better fix will be to actually change the setup.py file, go to the setup.py file. open it with nano or vim (the path to the file is in teh error) there you will have to navigate to the 738 th line or there about depending on the verion installed.

You will see a def __del__(self): function declared and in it there will the following code:

try:
        status = tf_session.TF_NewStatus()
        tf_session.TF_DeleteDeprecatedSession(self._session, status)

Along with the other things ofcourse,change that to the:

try:
        if tf_session is not None:
            status = tf_session.TF_NewStatus()
            tf_session.TF_DeleteDeprecatedSession(self._session, status

This will fix the issue, Please see that the other part of the court should remain as is also save a copy of the file before editing the same so in case you need to go back to the original version.

Inder
  • 3,711
  • 9
  • 27
  • 42
  • I have added the error message. What can that be caused by do you think? I'm not sure whether the error has to do something with the warnings though. – Aleksandr Berezutskii Feb 27 '19 at 10:57
  • @AleksandrBerezutskii also please go through the issue as mentioned in github discussions : https://github.com/tensorflow/tensorflow/issues/8652 – Inder Feb 27 '19 at 13:24