tensorflow module vERROR
Opened this issue · 4 comments
Hi everyone, I am facing an issue when running Deepbinner to demultiplex my fast5 files on a Mac Os:
(base)$ deepbinner classify --rapid ./fast5_pass/ > classifications
Traceback (most recent call last):
File "/Users/Comms/.local/bin/deepbinner", line 8, in <module>
sys.exit(main())
File "/Users/Comms/.local/lib/python3.7/site-packages/deepbinner/deepbinner.py", line 60, in main
classify(args)
File "/Users/Comms/.local/lib/python3.7/site-packages/deepbinner/classify.py", line 33, in classify
set_tensorflow_threads(args)
File "/Users/Comms/.local/lib/python3.7/site-packages/deepbinner/classify.py", line 418, in set_tensorflow_threads
config = tf.ConfigProto(intra_op_parallelism_threads=args.intra_op_parallelism_threads,
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
Since 'ConfigProto' is only available for older tensorflow versions (I checked ant it was remove in version 2.0), I tried pip install with tensorflow 1.15 version and got the following error:
$ deepbinner classify --rapid fast5_pass/ > classifications
Traceback (most recent call last):
File "/Users/Comms/.local/lib/python3.7/site-packages/keras/__init__.py", line 3, in <module>
from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
ModuleNotFoundError: No module named 'tensorflow.keras.layers.experimental.preprocessing'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Comms/.local/bin/deepbinner", line 8, in <module>
sys.exit(main())
File "/Users/Comms/.local/lib/python3.7/site-packages/deepbinner/deepbinner.py", line 59, in main
from .classify import classify
File "/Users/Comms/.local/lib/python3.7/site-packages/deepbinner/classify.py", line 24, in <module>
from keras.models import load_model
File "/Users/Comms/.local/lib/python3.7/site-packages/keras/__init__.py", line 6, in <module>
'Keras requires TensorFlow 2.2 or higher. '
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`
I am not sure if I am doing things right or if I must install a specific tensorflow version on my system to work it out, but I still getting the first Error when using version 2.0 or above. I would appreciate any help on this.
Thanks in advance.
I'm having this issue too.
I found this link (https://stackoverflow.com/questions/56127592/attributeerror-module-tensorflow-has-no-attribute-configproto) suggesting this fix
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
So I tried substituting that in the deepbinner.py and classify.py headers, but it's still throwing keras error messages and I don't know how to fix them.
(base) xcm@uoC02ZWCFFMD6M Desktop % deepbinner classify --rapid fast5_pass > fast5_demultiplex
WARNING:tensorflow:From /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Using TensorFlow backend.
2020-09-16 16:09:19.272221: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-09-16 16:09:19.297098: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fe144a75f50 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-09-16 16:09:19.297117: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Loading /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/deepbinner/models/SQK-RBK004_read_starts... Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/deepbinner", line 8, in
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/deepbinner/deepbinner.py", line 60, in main
classify(args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/deepbinner/classify.py", line 38, in classify
load_and_check_models(args.start_model, args.end_model, args.scan_size)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/deepbinner/classify.py", line 67, in load_and_check_models
start_model, start_input_size, start_output_size = load_trained_model(start_model_filename,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/deepbinner/classify.py", line 92, in load_trained_model
model = load_model(model_file)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/models.py", line 240, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/models.py", line 314, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/layers/init.py", line 52, in deserialize
return deserialize_keras_object(config,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/utils/generic_utils.py", line 137, in deserialize_keras_object
return cls.from_config(config['config'],
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/engine/topology.py", line 2490, in from_config
process_layer(layer_data)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/engine/topology.py", line 2475, in process_layer
layer = deserialize_layer(layer_data,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/layers/init.py", line 52, in deserialize
return deserialize_keras_object(config,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keras/utils/generic_utils.py", line 132, in deserialize_keras_object
raise ValueError('Unknown ' + printable_module_name +
ValueError: Unknown layer: Softmax
Edit: I could not get this to work on my Mac, but I got it to work on linux in a conda environment with python 3.6, tensorflow==1.15.0, and keras==2.1.5.
Thank you Morganx. I had the same problem and fixed with tensorflow 1.15.0 and keras 2.1.5.
Legend!
Ubuntu 20.04
Hello,
I tried using the following command:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
On Ubuntu 20.04 using a conda environment with python 3.6, keras==2.1.5 and tensorflow==1.15.0.
I tried using the classify command but i kept getting a warning asking me to use tf.compat.v1.ConfigProto and then error.
Thanks in advance