Commit e3ebecd7 authored by nd-02110114's avatar nd-02110114
Browse files

♻️ pillow go to a soft requirements

parent 8c8bc716
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ DeepChem requires these packages on any condition.

- [joblib](https://pypi.python.org/pypi/joblib)
- [pandas](http://pandas.pydata.org/)
- [Pillow](https://pypi.org/project/Pillow/)
- [scikit-learn](https://github.com/scikit-learn/scikit-learn.git)
- [tensorflow](https://www.tensorflow.org/)
  - `deepchem>=2.4.0` requires tensorflow v2
@@ -46,9 +45,13 @@ DeepChem requires these packages on any condition.

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)
- [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/)

## Installation

@@ -72,13 +75,13 @@ However, pip installation is under development, so this command may not work wel
`deepchem>=2.4.0`

```bash
pip install joblib pandas pillow scikit-learn tensorflow deepchem
pip install joblib pandas scikit-learn tensorflow deepchem
```

`deepchem<2.4.0`

```bash
pip install joblib pandas pillow scikit-learn==0.22.1 tensorflow==0.1.15 deepchem==2.3.0
pip install joblib pandas pillow scikit-learn==0.22.1 tensorflow(tensorflow-gpu)==1.15 deepchem==2.2.1.dev54
```

### Install from source
+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
+2 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ import time
import deepchem as dc
import tensorflow as tf
from deepchem.data import NumpyDataset
from PIL import Image


def undo_transforms(y, transformers):
@@ -1042,6 +1041,7 @@ class ImageTransformer(Transformer):

  def transform_array(self, X, y, w):
    """Transform the data in a set of (X, y, w) arrays."""
    from PIL import Image
    images = [scipy.ndimage.imread(x, mode='RGB') for x in X]
    images = [Image.fromarray(x).resize(self.size) for x in images]
    return np.array(images), y, w
@@ -1286,6 +1286,7 @@ class DataTransforms(Transformer):
                h - height of the images
                w - width of the images
    """
    from PIL import Image
    return Image.fromarray(self.Image).resize((h, w))

  def flip(self, direction="lr"):