deepchem / deepchem

Democratizing Deep-Learning for Drug Discovery, Quantum Chemistry, Materials Science and Biology
https://deepchem.io/
MIT License
5.41k stars 1.66k forks source link

I cannot run import sentence of deepchem on Jupyter notebook. #1714

Open sayo-yama opened 4 years ago

sayo-yama commented 4 years ago

Description: When I input import deepchem as dc, I catch the kernel error ("The kernel appears to have died. It will restart automatically.") in Jupyter notebook. So I cannot confirm the input result. If you know solution, could you help me? I want to try below source on Jupyter notebook. This is the sample source code of Chapter 5 in "Deep Learning for the Life Sciences".

import deepchem as dc
grid_featurizer = dc.feat.RdkitGridFeaturizer(
                    voxel_width=2.0, 
                    feature_types=['hbond', 'salt_bridge', 'pi_stack', 
                        'cation_pi', 'ecfp', 'splif'], 
                    sanitize=True, flatten=True)

task, datasets, transformers = dc.molnet.load_pdbbind(
    featurizer="grid", split="random", subset="core")
train_dataset, valid_dataset, test_dataset = datasets

from sklearn.ensemble import RandomForestRegressor
sklearn_model = RandomForestRegressor(n_estimators=100)
model = dc.models.SklearnModel(sklearn_model)
model.fit(train_dataset)

n_features = train_dataset.X.shape[1]
model = dc.models.MultitaskRegressor(n_tasks=len(pdbbind_tasks), 
n_features=n_features, 
layer_sizes=[2000, 1000], 
dropouts=0.5, 
learning_rate=0.0003)
model.fit(train_dataset, nb_epoch=250)

print("Evaluating model")
train_scores = model.evaluate(train_dataset, [metric], transformers)
test_scores = model.evaluate(test_dataset, [metric], transformers)

print("Train scores")
print(train_scores)

print("Test scores")
print(test_score)

When I input import deepchem as dc, kernel error will occur. But when I input from sklearn.ensemble import RandomForestRegressor sklearn_model = RandomForestRegressor(n_estimators=100) model = dc.models.SklearnModel(sklearn_model) model.fit(train_dataset), it will not occur.

I use this command to install deepchem and it seems to be success.

conda install -c deepchem -c rdkit -c conda-forge -c omnia deepchem=2.3.0
Your code sample here
peastman commented 4 years ago

Take a look at the console where you launched jupyter. There's a good chance some sort of error message will get written there when this happens.

sayo-yama commented 4 years ago

Sorry for inconvenience... How do I get Jupiter log? This may be the log from opening Jupyter notebook to getting kernel error.

Last login: Tue Nov 19 09:55:59 on ttys000

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
/Users/{userName}/.anaconda/navigator/a.tool ; exit;
(base) PCNamer:~ {userName}$ /Users/{userName}/.anaconda/navigator/a.tool ; exit;
[I 09:56:53.453 NotebookApp] JupyterLab extension loaded from /Users/{userName}/opt/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 09:56:53.453 NotebookApp] JupyterLab application directory is /Users/{userName}/opt/anaconda3/share/jupyter/lab
[I 09:56:53.456 NotebookApp] Serving notebooks from local directory: /Users/{userName}
[I 09:56:53.456 NotebookApp] The Jupyter Notebook is running at:
[I 09:56:53.456 NotebookApp] http://localhost:8888/?token=058e8ad720674420a58df5d7305ac3263f9580e48a7ed684
[I 09:56:53.456 NotebookApp]  or http://127.0.0.1:8888/?token=058e8ad720674420a58df5d7305ac3263f9580e48a7ed684
[I 09:56:53.457 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:56:53.470 NotebookApp] 

    To access the notebook, open this file in a browser:
        file:///Users/{userName}/Library/Jupyter/runtime/nbserver-1152-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=058e8ad720674420a58df5d7305ac3263f9580e48a7ed684
     or http://127.0.0.1:8888/?token=058e8ad720674420a58df5d7305ac3263f9580e48a7ed684
[I 09:56:59.711 NotebookApp] Creating new notebook in 
[I 09:57:00.604 NotebookApp] Kernel started: 3f4ad8d4-c137-44c9-b7e1-15eb9b0d76f9
[I 09:57:24.710 NotebookApp] Saving file at /Untitled10.ipynb
[I 09:57:33.603 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 3f4ad8d4-c137-44c9-b7e1-15eb9b0d76f9 restarted
peastman commented 4 years ago

That's the log, but I don't see any indication of what caused it to restart. Anyone else have ideas?

rbharath commented 4 years ago

Could you try running the tutorials on Colab? It might be an easier place to start if you're having installation issues.