Skip to content

Import error #4378

@UNCG-JSNN

Description

@UNCG-JSNN

Hi, I just found an import error when I tried to run deepchem on Pycharm. Here is the code

!pip install --pre deepchem[tensorflow]
!pip install tf_keras
import os
os.environ['TF_USE_LEGACY_KERAS'] = 'True'
import deepchem as dc
dc.version

tasks, datasets, transformers = dc.molnet.load_delaney(featurizer='GraphConv')
train_dataset, valid_dataset, test_dataset = datasets

model = dc.models.GraphConvModel(n_tasks=1, mode='regression', dropout=0.2,batch_normalize=False)

model.fit(train_dataset, nb_epoch=100)

After this step, there is an import error that says:
ImportError: keras.optimizers.legacy is not supported in Keras 3. When using tf.keras, to continue using a tf.keras.optimizers.legacy optimizer, you can install the tf_keras package (Keras 2) and set the environment variable TF_USE_LEGACY_KERAS=True to configure TensorFlow to use tf_keras when accessing tf.keras.

I hope someone can help me with this issue.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions