google-deepmind / alphafold

Open source code for AlphaFold.
Apache License 2.0
12.35k stars 2.21k forks source link

SymbolAlreadyExposedError #875

Closed QweQweQwe300 closed 8 months ago

QweQweQwe300 commented 9 months ago

Running Alphafold on Colab with all default settings including the default sequence_1

Step 4 "Search against genetic database" results in the following fatal error:

SymbolAlreadyExposedError                Traceback (most recent call last)
[<ipython-input-14-f1fdee26350e>](https://localhost:8080/#) in <cell line: 27>()
     25 import py3Dmol
     26 
---> 27 from alphafold.model import model
     28 from alphafold.model import config
     29 from alphafold.model import data

22 frames
[/opt/conda/lib/python3.10/site-packages/alphafold/model/model.py](https://localhost:8080/#) in <module>
     18 from absl import logging
     19 from alphafold.common import confidence
---> 20 from alphafold.model import features
     21 from alphafold.model import modules
     22 from alphafold.model import modules_multimer

[/opt/conda/lib/python3.10/site-packages/alphafold/model/features.py](https://localhost:8080/#) in <module>
     17 from typing import List, Mapping, Tuple
     18 
---> 19 from alphafold.model.tf import input_pipeline
     20 from alphafold.model.tf import proteins_dataset
     21 

[/opt/conda/lib/python3.10/site-packages/alphafold/model/tf/input_pipeline.py](https://localhost:8080/#) in <module>
     15 """Feature pre-processing input pipeline for AlphaFold."""
     16 
---> 17 from alphafold.model.tf import data_transforms
     18 from alphafold.model.tf import shape_placeholders
     19 import tensorflow.compat.v1 as tf

[/opt/conda/lib/python3.10/site-packages/alphafold/model/tf/data_transforms.py](https://localhost:8080/#) in <module>
     16 
     17 from alphafold.common import residue_constants
---> 18 from alphafold.model.tf import shape_helpers
     19 from alphafold.model.tf import shape_placeholders
     20 from alphafold.model.tf import utils

[/opt/conda/lib/python3.10/site-packages/alphafold/model/tf/shape_helpers.py](https://localhost:8080/#) in <module>
     14 
     15 """Utilities for dealing with shapes of TensorFlow tensors."""
---> 16 import tensorflow.compat.v1 as tf
     17 
     18 

[/opt/conda/lib/python3.10/site-packages/tensorflow/__init__.py](https://localhost:8080/#) in <module>
    476   # See b/196254385 for more details.
    477   try:
--> 478     importlib.import_module("keras.optimizers")
    479   except (ImportError, AttributeError):
    480     pass

[/usr/lib/python3.10/importlib/__init__.py](https://localhost:8080/#) in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

[/usr/local/lib/python3.10/dist-packages/keras/__init__.py](https://localhost:8080/#) in <module>
      1 """AUTOGENERATED. DO NOT EDIT."""
      2 
----> 3 from keras import __internal__
      4 from keras import activations
      5 from keras import applications

[/usr/local/lib/python3.10/dist-packages/keras/__internal__/__init__.py](https://localhost:8080/#) in <module>
      1 """AUTOGENERATED. DO NOT EDIT."""
      2 
----> 3 from keras.__internal__ import backend
      4 from keras.__internal__ import layers
      5 from keras.__internal__ import losses

[/usr/local/lib/python3.10/dist-packages/keras/__internal__/backend/__init__.py](https://localhost:8080/#) in <module>
      1 """AUTOGENERATED. DO NOT EDIT."""
      2 
----> 3 from keras.src.backend import _initialize_variables as initialize_variables
      4 from keras.src.backend import track_variable

[/usr/local/lib/python3.10/dist-packages/keras/src/__init__.py](https://localhost:8080/#) in <module>
     19 """
     20 
---> 21 from keras.src import applications
     22 from keras.src import distribute
     23 from keras.src import models

[/usr/local/lib/python3.10/dist-packages/keras/src/applications/__init__.py](https://localhost:8080/#) in <module>
     16 
     17 
---> 18 from keras.src.applications.convnext import ConvNeXtBase
     19 from keras.src.applications.convnext import ConvNeXtLarge
     20 from keras.src.applications.convnext import ConvNeXtSmall

[/usr/local/lib/python3.10/dist-packages/keras/src/applications/convnext.py](https://localhost:8080/#) in <module>
     26 import tensorflow.compat.v2 as tf
     27 
---> 28 from keras.src import backend
     29 from keras.src import initializers
     30 from keras.src import layers

[/usr/local/lib/python3.10/dist-packages/keras/src/backend.py](https://localhost:8080/#) in <module>
     33 from keras.src.distribute import distribute_coordinator_utils as dc
     34 from keras.src.dtensor import dtensor_api as dtensor
---> 35 from keras.src.engine import keras_tensor
     36 from keras.src.utils import control_flow_util
     37 from keras.src.utils import object_identity

[/usr/local/lib/python3.10/dist-packages/keras/src/engine/keras_tensor.py](https://localhost:8080/#) in <module>
     17 import tensorflow.compat.v2 as tf
     18 
---> 19 from keras.src.utils import object_identity
     20 
     21 # isort: off

[/usr/local/lib/python3.10/dist-packages/keras/src/utils/__init__.py](https://localhost:8080/#) in <module>
     18 
     19 # Serialization related
---> 20 from keras.src.saving.serialization_lib import deserialize_keras_object
     21 from keras.src.saving.serialization_lib import serialize_keras_object
     22 from keras.src.saving.object_registration import CustomObjectScope

[/usr/local/lib/python3.10/dist-packages/keras/src/saving/serialization_lib.py](https://localhost:8080/#) in <module>
     26 from keras.src.saving import object_registration
     27 from keras.src.saving.legacy import serialization as legacy_serialization
---> 28 from keras.src.saving.legacy.saved_model.utils import in_tf_saved_model_scope
     29 from keras.src.utils import generic_utils
     30 

[/usr/local/lib/python3.10/dist-packages/keras/src/saving/legacy/saved_model/utils.py](https://localhost:8080/#) in <module>
     28 from keras.src.utils import tf_contextlib
     29 from keras.src.utils.generic_utils import LazyLoader
---> 30 from keras.src.utils.layer_utils import CallFunctionSpec
     31 
     32 training_lib = LazyLoader("training_lib", globals(), "keras.src.engine.training")

[/usr/local/lib/python3.10/dist-packages/keras/src/utils/layer_utils.py](https://localhost:8080/#) in <module>
     24 import tensorflow.compat.v2 as tf
     25 
---> 26 from keras.src import initializers
     27 from keras.src.utils import io_utils
     28 

[/usr/local/lib/python3.10/dist-packages/keras/src/initializers/__init__.py](https://localhost:8080/#) in <module>
     21 
     22 from keras.src.initializers import initializers
---> 23 from keras.src.initializers import initializers_v1
     24 from keras.src.saving import serialization_lib
     25 from keras.src.saving.legacy import serialization as legacy_serialization

[/usr/local/lib/python3.10/dist-packages/keras/src/initializers/initializers_v1.py](https://localhost:8080/#) in <module>
     30 _v1_glorot_normal_initializer = tf.compat.v1.glorot_normal_initializer
     31 
---> 32 keras_export(v1=["keras.initializers.Zeros", "keras.initializers.zeros"])(
     33     _v1_zeros_initializer
     34 )

[/opt/conda/lib/python3.10/site-packages/tensorflow/python/util/tf_export.py](https://localhost:8080/#) in __call__(self, func)
    346 
    347     _, undecorated_func = tf_decorator.unwrap(func)
--> 348     self.set_attr(undecorated_func, api_names_attr, self._names)
    349     self.set_attr(undecorated_func, api_names_attr_v1, self._names_v1)
    350 

[/opt/conda/lib/python3.10/site-packages/tensorflow/python/util/tf_export.py](https://localhost:8080/#) in set_attr(self, func, api_names_attr, names)
    362     if api_names_attr in func.__dict__:
    363       if not self._allow_multiple_exports:
--> 364         raise SymbolAlreadyExposedError(
    365             'Symbol %s is already exposed as %s.' %
    366             (func.__name__, getattr(func, api_names_attr)))  # pylint: disable=protected-access

SymbolAlreadyExposedError: Symbol Zeros is already exposed as ().`
Htomlinson14 commented 9 months ago

Hi! Thanks for raising this. This is likely due to recent changes in the colab runtime. We are working on a fix internally and should hopefully be able to resolve this shortly.

cstack commented 9 months ago

I also got this error today

zhao20000413 commented 9 months ago

me too. Today I meet this problem.

zhao20000413 commented 9 months ago

If you fix this problem, plz tell me. TYSM!

vinecastle commented 9 months ago

The issue does not occur for me anymore now, try resetting your runtime.

wilEd22 commented 9 months ago

Has there been any update for this issue? I am sadly still running into the same problem

zhao20000413 commented 9 months ago

The issue does not occur for me anymore now, try resetting your runtime.

I still meet this problem. TAT

QweQweQwe300 commented 9 months ago

Problem

The issue does not occur for me anymore now, try resetting your runtime.

The problem remains even after complete system reset and in different browsers (Opera, Edge, Firefox)

vinecastle commented 9 months ago

The issue does not occur for me anymore now, try resetting your runtime.

However, now I get

WARNING:jax._src.xla_bridge:CUDA backend failed to initialize: Found cuBLAS version 120103, but JAX was built against version 120205, which is newer. The copy of cuBLAS that is installed must be at least as new as the version against which JAX was built. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)

cstack commented 9 months ago

For anyone who is still waiting on a fix, there is another Alphafold Colab notebook that works https://colab.research.google.com/github/sokrypton/ColabFold/blob/main/AlphaFold2.ipynb

SK1-biocopy commented 8 months ago

I also have the same issue. A fix would be great.

h-b commented 8 months ago

I'm getting the same error (default sequence). I assume #876 is a duplicate of this issue.

---------------------------------------------------------------------------
SymbolAlreadyExposedError                 Traceback (most recent call last)
[<ipython-input-5-f1fdee26350e>](https://localhost:8080/#) in <cell line: 27>()
     25 import py3Dmol
     26 
---> 27 from alphafold.model import model
     28 from alphafold.model import config
     29 from alphafold.model import data

22 frames
[/opt/conda/lib/python3.10/site-packages/tensorflow/python/util/tf_export.py](https://localhost:8080/#) in set_attr(self, func, api_names_attr, names)
    362     if api_names_attr in func.__dict__:
    363       if not self._allow_multiple_exports:
--> 364         raise SymbolAlreadyExposedError(
    365             'Symbol %s is already exposed as %s.' %
    366             (func.__name__, getattr(func, api_names_attr)))  # pylint: disable=protected-access

SymbolAlreadyExposedError: Symbol Zeros is already exposed as ().
cemcv25 commented 8 months ago

I also have the same error

SymbolAlreadyExposedError Traceback (most recent call last)

in <cell line: 27>() 25 import py3Dmol 26 ---> 27 from alphafold.model import model 28 from alphafold.model import config 29 from alphafold.model import data

22 frames

/opt/conda/lib/python3.10/site-packages/tensorflow/python/util/tf_export.py in set_attr(self, func, api_names_attr, names) 362 if api_names_attr in func.dict: 363 if not self._allow_multiple_exports: --> 364 raise SymbolAlreadyExposedError( 365 'Symbol %s is already exposed as %s.' % 366 (func.name, getattr(func, api_names_attr))) # pylint: disable=protected-access

SymbolAlreadyExposedError: Symbol Zeros is already exposed as ().

omikhailovskii commented 8 months ago

It appears that the problem is being caused by Keras, which is not a strict dependency, but is installed automatically with the necessary Tensorflow. Therefore, once AlphaFold with the required dependencies is installed (step 2), you can resolve the issue by uninstalling Keras using a command like %shell python -m pip uninstall keras -y.

schiracha commented 8 months ago

Thank you!! Have been trying to figure this out for a week! I did have to sudo in order to do this properly. Without sudo it appeared to work, but threw a warning, so i ran again to make sure it didn't find the package which it did not, but when I ran as sudo it found it again and then did not give a warning. and Step 4 is now running, so we will see. %shell sudo python -m pip uninstall keras -y

Htomlinson14 commented 8 months ago

Thanks to @omikhailovskii for suggesting uninstalling keras. Colab should now be working after https://github.com/google-deepmind/alphafold/commit/632ef575c64eff9eb5ed96c8c7b055bf675421ac