matchms / ms2deepscore

Deep learning similarity measure for comparing MS/MS spectra with respect to their chemical similarity
Apache License 2.0
53 stars 24 forks source link

Fix Tensorflow import errors #99

Closed svenvanderburg closed 2 years ago

svenvanderburg commented 2 years ago

See these linter results

It's probably related to a new version of Tensorflow (2.8.0).

ms2deepscore/data_generators.py
  Line: 8
    pylint: import-error / Unable to import 'tensorflow.keras.utils'
  Line: 96
    pylint: consider-using-f-string / Formatting a regular string which could be a f-string (col 29)

ms2deepscore/models/SiameseModel.py
  Line: 5
    pylint: import-error / Unable to import 'tensorflow.keras.layers'
florian-huber commented 2 years ago

The keras import issue also happend with some past versions of tensorflow, so it could again be the same thing (see https://github.com/tensorflow/tensorflow/issues/26502). I will work fine at runtime but the linter oder editors will complain because keras is not in the tensorflow init.

We should probably switch to from tensorflow.python import keras or similar.

florian-huber commented 2 years ago

I was wrong. Switching to tensorflow.python is not the way to go! I will try to simply silence the pylint import warnings since it seems to be tensorflow internal issue.

florian-huber commented 2 years ago

Should be fixed with #101