Unverified Commit 614d3591 authored by Bharath Ramsundar's avatar Bharath Ramsundar Committed by GitHub
Browse files

Merge pull request #1871 from nd-02110114/update-script

Update Dockerfile and installation section in README.md
parents c0821eff 36c3ddb3
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
jobs:
  include:
    - name: 'Python 3.6'
    - name: "Python 3.6"
      language: python
      python: '3.6'
      python: "3.6"
      sudo: required
      dist: xenial

    - name: 'Python 3.7'
    - name: "Python 3.7"
      language: python
      python: '3.7'
      python: "3.7"
      sudo: required
      dist: xenial

    - name: 'Windows'
    - name: "Windows"
      language: c # Not really, but travis doesn't support python on Windows
      python: '3.7'
      python: "3.7"
      os: windows

install:
  - if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O anaconda.sh;
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
    export python_version=$TRAVIS_PYTHON_VERSION;
    bash anaconda.sh -b -p $HOME/anaconda;
    export PATH="$HOME/anaconda/bin:$PATH";
    bash miniconda.sh -b -p $HOME/miniconda;
    source "$HOME/miniconda/etc/profile.d/conda.sh";
    fi
  - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
    choco install miniconda3 --params="'/JustMe /AddToPath:1'";
@@ -34,7 +34,7 @@ install:
  - conda update -q conda
  - conda config --add channels http://conda.binstar.org/omnia
  - bash scripts/install_deepchem_conda.sh deepchem
- source activate deepchem
  - conda activate deepchem
  - pip install yapf==0.22.0
  - pip install coveralls
  - python setup.py install
+152 −86
Original line number Diff line number Diff line
# DeepChem

[![Build Status](https://travis-ci.org/deepchem/deepchem.svg?branch=master)](https://travis-ci.org/deepchem/deepchem)
[![Coverage Status](https://coveralls.io/repos/github/deepchem/deepchem/badge.svg?branch=master)](https://coveralls.io/github/deepchem/deepchem?branch=master)
[![Anaconda-Server Badge](https://anaconda.org/deepchem/deepchem/badges/version.svg)](https://anaconda.org/deepchem/deepchem)
[![PyPI version](https://badge.fury.io/py/deepchem.svg)](https://badge.fury.io/py/deepchem)


DeepChem aims to provide a high quality open-source toolchain
that democratizes the use of deep-learning in drug discovery,
materials science, quantum chemistry, and biology.

### Table of contents:

* [Requirements](#requirements)
* [Installation](#installation)
    * [Easy Install with Conda](#easy-install-with-conda)
    * [Docker](#using-a-docker-image)
    * [Conda Environment](#installing-from-source-in-a-conda-environment)
    * [Windows](#installing-in-windows)
* [FAQ and Troubleshooting](#faq-and-troubleshooting)
* [Getting Started](#getting-started)
* [Contributing to DeepChem](/CONTRIBUTING.md)
    * [Code Style Guidelines](/CONTRIBUTING.md#code-style-guidelines)
    * [Documentation Style Guidelines](/CONTRIBUTING.md#documentation-style-guidelines)
    * [Gitter](#gitter)
* [DeepChem Publications](#deepchem-publications)
* [Examples](/examples)
* [About Us](#about-us)
* [Citing DeepChem](#citing-deepchem)
- [Requirements](#requirements)
- [Installation](#installation)
  - [Install latest package with conda](#install-via-conda-recommendation)
  - [Install latest package with pip (WIP)](#install-via-pip-wip)
  - [Install from source](#install-from-source)
    - [General installation](#general-installation)
    - [Use powershell (Windows)](#use-powershell-windows)
  - [Install using a Docker (WIP)](#install-using-a-docker-with-gpu-wip)
- [FAQ and Troubleshooting](#faq-and-troubleshooting)
- [Getting Started](#getting-started)
- [Contributing to DeepChem](/CONTRIBUTING.md)
  - [Code Style Guidelines](/CONTRIBUTING.md#code-style-guidelines)
  - [Documentation Style Guidelines](/CONTRIBUTING.md#documentation-style-guidelines)
  - [Gitter](#gitter)
- [DeepChem Publications](#deepchem-publications)
- [Examples](/examples)
- [About Us](#about-us)
- [Citing DeepChem](#citing-deepchem)

## Requirements
* [pandas](http://pandas.pydata.org/)
* [joblib](https://pypi.python.org/pypi/joblib)
* [sklearn](https://github.com/scikit-learn/scikit-learn.git)
* [numpy](https://store.continuum.io/cshop/anaconda/)
* [tensorflow](https://www.tensorflow.org/)

DeepChem requires these packages on any condition.

- [joblib](https://pypi.python.org/pypi/joblib)
- [pandas](http://pandas.pydata.org/)
- [scikit-learn](https://github.com/scikit-learn/scikit-learn.git)
- [tensorflow](https://www.tensorflow.org/)
  - `deepchem>=2.4.0` requires tensorflow v2
  - `deepchem<2.4.0` requires tensorflow v1

### Soft Requirements

DeepChem has a number of "soft" requirements. These are packages which are needed for various submodules of DeepChem but not for the package as a whole.

* [RDKit](http://www.rdkit.org/docs/Install.html)
* [six](https://pypi.python.org/pypi/six)
* [MDTraj](http://mdtraj.org/)
* [PDBFixer](https://github.com/pandegroup/pdbfixer)
* [Pillow](https://pillow.readthedocs.io/en/stable/)
- [MDTraj](http://mdtraj.org/)
- [NetworkX](https://networkx.github.io/documentation/stable/index.html)
- [PDBFixer](https://github.com/pandegroup/pdbfixer)
- [Pillow](https://pypi.org/project/Pillow/)
- [RDKit](http://www.rdkit.org/docs/Install.html)
- [simdna](https://github.com/kundajelab/simdna)
- [XGBoost](https://xgboost.readthedocs.io/en/latest/)

### Super easy install via pip3
## Installation

```bash
pip3 install joblib pandas sklearn tensorflow pillow deepchem
```
### Install via conda (Recommendation)

`deepchem>=2.4.0`

### Easy Install via Conda
Coming soon...

`deepchem<2.4.0`

```bash
conda install -c deepchem -c rdkit -c conda-forge -c omnia deepchem=2.3.0
pip install tensorflow==1.15
conda install -c deepchem -c rdkit -c conda-forge -c omnia deepchem==2.3.0
```

If you want GPU support:

```bash
conda install -c deepchem -c rdkit -c conda-forge -c omnia deepchem-gpu=2.3.0
conda install -y -q scikit-learn=0.22
conda install -c deepchem -c rdkit -c conda-forge -c omnia deepchem-gpu==2.3.0
```

**Note:** The above commands install the latest stable version of `deepchem` and _do not install from source_. If you need to install from source make sure you follow the steps [here](#using-a-conda-environment).
### Install via pip (WIP)

### Using a Docker Image
Using a docker image requires an NVIDIA GPU.  If you do not have a GPU please follow the directions for [using a conda environment](#installing-from-source-in-a-conda-environment)
In order to get GPU support you will have to use the [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) plugin.
``` bash
# This will the download the latest stable deepchem docker image into your images
docker pull deepchemio/deepchem
You are able to try to install deepchem via pip using the following command.  
However, pip installation is under development, so this command may not work well.

# This will create a container out of our latest image with GPU support
nvidia-docker run -i -t deepchemio/deepchem
`deepchem>=2.4.0`

# You are now in a docker container whose python has deepchem installed
# For example you can run our tox21 benchmark
cd deepchem/examples
python benchmark.py -d tox21
Coming soon...

# Or you can start playing with it in the command line
pip install jupyter
ipython
import deepchem as dc
`deepchem<2.4.0`

```bash
pip install joblib pandas pillow scikit-learn==0.22 tensorflow==1.15 deepchem==2.2.1.dev54
```

If you want GPU support:

```bash
pip install joblib pandas pillow scikit-learn==0.22 tensorflow-gpu==1.15 deepchem==2.2.1.dev54
```

### Installing from source in a conda environment
You can install deepchem in a new conda environment using the conda commands in scripts/install_deepchem_conda.sh
Installing via this script will ensure that you are **installing from the source**.
### Install from source

You can install deepchem in a new conda environment using the conda commands in `scripts/install_deepchem_conda.sh.` Installing via this script will ensure that you are **installing from the source**.  
The following script requires `conda>=4.4` because it uses the `conda activate` command. (Please see the detail from [here](https://github.com/conda/conda/blob/a4c4feae404b2b378e106bd25f62cc8be15c768f/CHANGELOG.md#440-2017-12-20))

First, please clone the deepchem repository from GitHub.

```bash
git clone https://github.com/deepchem/deepchem.git      # Clone deepchem source code from GitHub
git clone https://github.com/deepchem/deepchem.git
cd deepchem
```
If you don't want GPU support:
```
bash scripts/install_deepchem_conda.sh deepchem         # If you don't want GPU support
```
If you want GPU support:
```
gpu=1 bash scripts/install_deepchem_conda.sh deepchem         # If you want GPU support

Then, follow each instruction on your OS.

### General installation

```bash
bash scripts/install_deepchem_conda.sh deepchem
```
Note : `gpu=0 bash scripts/install_deepchem_conda.sh deepchem` will also install CPU supported `deepchem`.

Before activating deepchem environment, make sure conda has been initialized.  
Check if there is a `(base)` in your command line.  
If not, use `conda init bash` to activate it, then:

```
source activate deepchem
conda activate deepchem
python setup.py install                                # Manual install
nosetests -a '!slow' -v deepchem --nologcapture        # Run tests
```
This creates a new conda environment `deepchem` and installs in it the dependencies that
are needed. To access it, use the `conda activate deepchem` command (if your conda version >= 4.4) and use `source activate deepchem` command (if your conda version < 4.4).

Check [this link](https://conda.io/docs/using/envs.html) for more information about
the benefits and usage of conda environments. **Warning**: Segmentation faults can [still happen](https://github.com/deepchem/deepchem/pull/379#issuecomment-277013514)
via this installation procedure.
Check [this link](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) for more information about the installation of conda environments.

### Installing in Windows
### Use powershell (Windows)

Currently you have to install from source in windows. The following scripts requires `conda>4.6`.
Currently you have to install from source in windows.

If you want gpu support, use the following command in powershell:
```ps1
.\scripts\install_deepchem_conda.ps1 -gpu 1 deepchem
```
Or you can use the following command to install deepchem without gpu support.
```ps1
.\scripts\install_deepchem_conda.ps1 -gpu 0 deepchem
.\scripts\install_deepchem_conda.ps1 deepchem
```

Before activating deepchem envrionment, make sure conda-powershell has been initialized.
Check if there is a `(base)` before `PS` in powershell. If not, use `conda init powershell`
to activate it, then:
```
Before activating deepchem environment, make sure conda-powershell has been initialized.  
Check if there is a `(base)` before `PS` in powershell.  
If not, use `conda init powershell` to activate it, then:

```bash
conda activate deepchem
python setup.py install
nosetests -a '!slow' -v deepchem --nologcapture
```

### Install using a Docker (WIP)

### Build the image from Dockerfile

We prepare for [sample Dockerfiles](https://github.com/deepchem/deepchem/tree/master/docker) to install deepchem from source codes and conda package manager. Please check them!

### Use the official deepchem image (WIP)

We couldn't check if this introduction works well or not.

First, you pull the latest stable deepchem docker image.

```bash
docker pull deepchemio/deepchem
```

Then, you create a container based on our latest image.

```bash
docker run -it deepchemio/deepchem
```

If you want GPU support:

```bash
# If nvidia-docker is installed
nvidia-docker run -it deepchemio/deepchem
docker run --runtime nvidia -it deepchemio/deepchem

# If nvidia-container-toolkit is installed
docker run --gpus all -it deepchemio/deepchem
```

You are now in a docker container whose python has deepchem installed.

```bash
# you can start playing with it in the command line
pip install jupyter
ipython
import deepchem as dc

# you can run our tox21 benchmark
cd /deepchem/examples
python benchmark.py -d tox21
```

## FAQ and Troubleshooting

1. DeepChem currently supports Python 3.5 through 3.7, and is supported on 64 bit Linux and Mac OSX. Note that DeepChem is not currently maintained for older versions of Python or with other operating systems.
2. Question: I'm seeing some failures in my test suite having to do with MKL
   ```Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so.```
   `Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so.`

   Answer: This is a general issue with the newest version of `scikit-learn` enabling MKL by default. This doesn't play well with many linux systems. See [BVLC/caffe#3884](https://github.com/BVLC/caffe/issues/3884) for discussions. The following seems to fix the issue

   ```bash
   conda install nomkl numpy scipy scikit-learn numexpr
   conda remove mkl mkl-service
   ```

3. Note that when using Ubuntu 16.04 server or similar environments, you may need to ensure libxrender is provided via e.g.:

```bash
sudo apt-get install -y libxrender-dev
```

## Getting Started

The DeepChem project maintains an extensive colelction of [tutorials](https://github.com/deepchem/deepchem/tree/master/examples/tutorials). All tutorials are designed to be run on Google colab (or locally if you prefer). Tutorials are arranged in a suggested learning sequence which will take you from beginner to proficient at molecular machine learning and computational biology more broadly.

After working through the tutorials, you can also go through other [examples](https://github.com/deepchem/deepchem/tree/master/examples). To apply `deepchem` to a new problem, try starting from one of the existing examples or tutorials and modifying it step by step to work with your new use-case. If you have questions or comments you can raise them on our [gitter](https://gitter.im/deepchem/Lobby).

### Gitter

Join us on gitter at [https://gitter.im/deepchem/Lobby](https://gitter.im/deepchem/Lobby). Probably the easiest place to ask simple questions or float requests for new features.

## About Us

DeepChem is managed by a team of open source contributors. Anyone is free to join and contribute!

## Citing DeepChem
@@ -177,4 +242,5 @@ To cite this book, please use this bibtex entry:
```

## Version

2.1.0
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ from deepchem.utils.genomics import encode_fasta_sequence
from deepchem.feat import UserDefinedFeaturizer
from deepchem.data import DiskDataset, NumpyDataset, ImageDataset
import zipfile
from PIL import Image

logger = logging.getLogger(__name__)

@@ -625,6 +624,7 @@ class ImageLoader(DataLoader):

  @staticmethod
  def load_img(image_files):
    from PIL import Image
    images = []
    for image_file in image_files:
      _, extension = os.path.splitext(image_file)
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ import os
import unittest
import tempfile
from scipy import misc
from PIL import Image
import deepchem as dc
import zipfile

@@ -17,6 +16,7 @@ class TestImageLoader(unittest.TestCase):

  def setUp(self):
    super(TestImageLoader, self).setUp()
    from PIL import Image
    self.current_dir = os.path.dirname(os.path.abspath(__file__))
    self.tif_image_path = os.path.join(self.current_dir, "a_image.tif")

+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ import pandas as pd
import deepchem as dc
import tensorflow as tf
import scipy.ndimage
from PIL import Image


class TestTransformers(unittest.TestCase):
@@ -613,6 +612,7 @@ class TestTransformers(unittest.TestCase):
    assert np.allclose(flip_lr, check_lr)

  def test_scaling(self):
    from PIL import Image
    # Check Scales
    dt = DataTransforms(self.d)
    h = 150
Loading