apcamargo / RNAsamba

A tool for computing the coding potential of RNA transcript sequences using deep learning classification model
https://rnasamba.lge.ibi.unicamp.br/
GNU General Public License v3.0
52 stars 3 forks source link

AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__' #12

Closed nabiafshan closed 3 years ago

nabiafshan commented 3 years ago

Hi!

I'm trying to use RNASamba for predicting the coding potential of an example sequence.

I got an error using the online version:

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Then I tried the pip install in this colab notebook. I run into this error:

Using TensorFlow backend.
Traceback (most recent call last):
  File "/usr/local/bin/rnasamba", line 5, in <module>
    from rnasamba.cli import cli
  File "/usr/local/lib/python3.7/dist-packages/rnasamba/__init__.py", line 21, in <module>
    from rnasamba.core.model import RNAsambaClassificationModel, RNAsambaTrainModel
  File "/usr/local/lib/python3.7/dist-packages/rnasamba/core/model.py", line 26, in <module>
    from keras import optimizers
  File "/usr/local/lib/python3.7/dist-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/usr/local/lib/python3.7/dist-packages/keras/utils/__init__.py", line 24, in <module>
    from .vis_utils import model_to_dot
  File "/usr/local/lib/python3.7/dist-packages/keras/utils/vis_utils.py", line 7, in <module>
    from ..models import Model
  File "/usr/local/lib/python3.7/dist-packages/keras/models.py", line 10, in <module>
    from .engine.input_layer import Input
  File "/usr/local/lib/python3.7/dist-packages/keras/engine/__init__.py", line 3, in <module>
    from .input_layer import Input
  File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_layer.py", line 7, in <module>
    from .base_layer import Layer
  File "/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py", line 11, in <module>
    from .. import initializers
  File "/usr/local/lib/python3.7/dist-packages/keras/initializers/__init__.py", line 124, in <module>
    populate_deserializable_objects()
  File "/usr/local/lib/python3.7/dist-packages/keras/initializers/__init__.py", line 49, in populate_deserializable_objects
    LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/util/module_wrapper.py", line 193, in __getattr__
    attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'

Could you help me resolve this?

Thanks!

apcamargo commented 3 years ago

Sure!

Try this in your Colab:

!pip3 install tensorflow==1.14.0
!pip3 install keras==2.2.4
!pip3 install h5py==2.10.0
!pip install rnasamba
!curl -O https://raw.githubusercontent.com/apcamargo/RNAsamba/master/data/full_length_weights.hdf5
!curl -O https://raw.githubusercontent.com/apcamargo/RNAsamba/master/data/partial_length_weights.hdf5
!curl -O https://rnasamba.lge.ibi.unicamp.br/static/example.fasta
!rnasamba classify out.out example.fasta full_length_weights.hdf5
!cat out.out

About the webserver, I'm not sure what is going on. I'll try to figure out as soon as possible. Thank you for letting me know!

apcamargo commented 3 years ago

@nabiafshan The webapp is now working properly.

The Colab problem was probably due to the fact that the Colab's default environment is not clean (it comes with newer versions of TensorFlow and Keras pre-installed). But the commands above should fix it.

nabiafshan commented 3 years ago

Thank you for the great documentation, the web server and the speedy reply! 😄

apcamargo commented 3 years ago

A pleasure to help :)