Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
formats:
- epub
- pdf

python:
version: 3.6
pip_install: true
extra_requirements:
- doc
- dev
- test
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ env:


install:
- pip install tensorflow
- pip install -r requirements.txt
- pip install -e .[dev,doc,test]
- pip install -e .[tf_cpu,dev,test,doc]


script:
Expand Down
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,38 @@ The simplest way to install TensorLayer is:
# for master version (Recommended)
$ pip install git+https://github.com/tensorlayer/tensorlayer.git

# for stable version
# for last stable version
$ pip install tensorlayer

# for latest release candidate
$ pip install --pre tensorlayer
```

If you prefer to build from sources in a development objective
```bash
# First clone the repository
$ git clone https://github.com/tensorlayer/tensorlayer.git
$ cd tensorlayer

# Install virtualenv if necessary
$ pip install virtualenv

# Then create a virtualenv called venv inside
$ virtualenv venv

# Activate the virtualenv

# Linux:
$ source venv/bin/activate

# Windows:
$ venv\Scripts\activate.bat

# for a machine **without** an NVIDIA GPU
$ pip install -e .[tf_cpu,dev,test,doc]

# for a machine **with** an NVIDIA GPU
$ pip install -e .[tf_gpu,dev,test,doc]
```

Dockerfile is supplied to build images, build as usual
Expand All @@ -80,6 +110,12 @@ $ docker build -t tensorlayer:latest .
$ docker build -t tensorlayer:latest-gpu -f Dockerfile.gpu .
```

Launching the unittest:

```bash
$ pytest
```

Please check [documentation](http://tensorlayer.readthedocs.io/en/latest/user/installation.html) for detailed instructions.


Expand Down
10 changes: 0 additions & 10 deletions docs/requirements-rtd.txt

This file was deleted.

3 changes: 0 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Keep this file in sync with requirements-rtd.txt, except tensorflow

flake8-docstrings>=1.3,<1.4
matplotlib>=2.2,<2.3
pymongo>=3.6,<3.7
progressbar2>=3.37,<3.38
scikit-image>=0.13,<0.14
scipy>=1.0,<1.1
sphinx>=1.7,<1.8
tensorflow>=1.7,<1.8
27 changes: 20 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
else:
long_description = 'See ' + __homepage__


# ======================= Reading Requirements files as TXT files =======================

def req_file(filename):
Expand All @@ -51,6 +50,24 @@ def req_file(filename):
# Example: `\n` at the end of each line
return [x.strip() for x in content]

# ======================= Defining the requirements var =======================

install_requires = req_file("requirements.txt")

extras_require = {
'tf_cpu': ['tensorflow>=1.8.0,<1.9'],
'tf_gpu': ['tensorflow-gpu>=1.8.0,<1.9'],
'dev': req_file("requirements_dev.txt"),
'doc': req_file("docs/requirements.txt"),
'test': req_file("tests/requirements.txt")
}

# Readthedocs requires TF 1.5.0 to build properly
if os.environ.get('READTHEDOCS', None) == 'True':
install_requires.append("tensorflow==1.5.0")

# ======================= Define the package setup =======================

setup(
name=__package_name__,

Expand Down Expand Up @@ -125,16 +142,12 @@ def req_file(filename):
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=req_file("requirements.txt"),
install_requires=install_requires,

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# $ pip install -e .[test]
extras_require={
'dev': req_file("requirements_dev.txt"),
'doc': req_file("docs/requirements.txt"),
'test': req_file("tests/requirements.txt")
},
extras_require=extras_require,
scripts=[
'tl',
],
Expand Down
59 changes: 36 additions & 23 deletions tensorlayer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,44 @@
"""Deep learning and Reinforcement learning library for Researchers and Engineers"""
from __future__ import absolute_import

try:
import pkg_resources
installed_packages = [d for d in pkg_resources.working_set]

TF_is_installed = False
TL_is_installed = False

for package in installed_packages:
if 'tensorflow' in package.project_name:
TF_is_installed = True
if 'tensorlayer' in package.project_name and 'site-packages' in package.location:
TL_is_installed = True

if TF_is_installed: # The tensorlayer package is installed
import tensorflow
except ImportError:

from . import activation
from . import cost
from . import files
from . import iterate
from . import layers
from . import models
from . import utils
from . import visualize
from . import prepro
from . import nlp
from . import rein
from . import distributed

# alias
act = activation
vis = visualize

global_flag = {}
global_dict = {}

elif TL_is_installed:
install_instr = "Please make sure you install a recent enough version of TensorFlow."
raise ImportError("__init__.py : Could not import TensorFlow." + install_instr)

from . import activation
from . import cost
from . import files
from . import iterate
from . import layers
from . import models
from . import utils
from . import visualize
from . import prepro
from . import nlp
from . import rein
from . import distributed

# alias
act = activation
vis = visualize
raise ImportError("__init__.py : Could not import TensorFlow. {}".format(install_instr))

# Use the following formating: (major, minor, patch, prerelease)
VERSION = (1, 8, 5, 'rc2')
Expand All @@ -40,6 +56,3 @@
__description__ = 'Reinforcement Learning and Deep Learning Library for Researcher and Engineer.'
__license__ = 'apache'
__keywords__ = 'deep learning, machine learning, computer vision, nlp, supervised learning, unsupervised learning, reinforcement learning, tensorflow'

global_flag = {}
global_dict = {}