Skip to content

Commit 9e66263

Browse files
pyup-botDEKHTIARJonathan
authored andcommitted
Scipy Update to 1.1.0 and TL import restructured to fix #549 (#550)
* Pin scipy to latest version 1.1.0 * Pin scipy to latest version 1.1.0 * Update requirements.txt * Update requirements.txt * Update requirements.txt * Requirements Structure Changed - Import Process modified to fix #549 * Error Fix * Indent error fix * Python Style Cleaning - YAPF and Codacy Fixed
1 parent cde9d1c commit 9e66263

File tree

8 files changed

+31
-39
lines changed

8 files changed

+31
-39
lines changed

.readthedocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ python:
66
version: 3.5
77
pip_install: true
88
extra_requirements:
9-
- doc
9+
- db
1010
- dev
11+
- doc
1112
- test

.travis.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ language: python
44
python:
55
- "2.7"
66
- "3.5"
7-
- "3.6"
8-
7+
- "3.6"
8+
99
env:
1010
global:
11-
11+
1212
- PYPI_USER='jonathandekhtiar'
1313

1414
### == PYPI_PASSWORD === ###
@@ -18,25 +18,25 @@ env:
1818
### === GITHUB_PERSONAL_TOKEN === ###
1919
## To update: travis encrypt GITHUB_PERSONAL_TOKEN=################################
2020
- secure: "GmdokEVWFS4LlSIdhfYvET+53hcuN9gN5gbhYduWkvyqvCJnP5PENzxdDz6Y3EJCSXxfKTT+jBLmJkgOElgeWxyAEa+wGj3jJzpjFD8BEcxIf5mNsyJ2LryzecFoKjcCR7viid14GDEYSeA3UB0MgKgitm9rMmcQ2W9RLJfAmTfGRQ+kMwhM7GTeFc5c99YL7DW7AUFSbiAac/k50AMx2j9KNT1JAGhDoc5yVTdVvtKrdtuCZUa82q4Cm/h4IEd6BbNrcImYyxQ814LHCrHWBi9jmuc+UxqvsTH1ErNapIObz490ri3DmZg+LUrH5dIuhSa5HGqZjob6tKG6XCKFWOuv9E73+URDitJllXHc1qSP/K61SMmsQrE2FnaxVjxpQCOcqueRMKszwH5/k3UoGbUPWsBFwbBznXrnHO/DNHAgL9XwOFP6biPP8TKp2ReX41YwcU6sbiYb7naGWo3Dhe+yEB9wBGOwuGHipDQm9R4SSIJgjpdc642KjcEMQqb3yL7DWpOmItXMxoGNM+X93kU4u4u1tGgq1yxnhEk6VG2l/yI6A2QOVIPyOu+L9FkZL3mrl9mbUeBKr/SHX4CTFODi5io8D0lqwNSRZrmi/GGWh2glbNnTapD67UnTnsh/6LE2YiSqGteH47EByb9V4ykrjfdv5EZhyJNwI7jYPDw="
21-
22-
21+
22+
2323
install:
24-
- pip install -e .[tf_cpu,dev,test,doc]
25-
26-
24+
- pip install -e .[tf_cpu,db,dev,test,doc]
25+
26+
2727
script:
2828
# units test
2929
# https://docs.pytest.org/en/latest/
3030
- pytest
31-
32-
31+
32+
3333
before_deploy:
3434
- python setup.py sdist
3535
- python setup.py bdist_wheel
3636
- python setup.py bdist_wheel --universal
3737
- python setup.py egg_info
38-
39-
38+
39+
4040
deploy:
4141

4242
# Documentation: https://docs.travis-ci.com/user/deployment/pypi/

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ $ source venv/bin/activate
9494
$ venv\Scripts\activate.bat
9595

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

9999
# for a machine **with** an NVIDIA GPU
100-
$ pip install -e .[tf_gpu,dev,test,doc]
100+
$ pip install -e .[tf_gpu,db,dev,test,doc]
101101
```
102102

103103
Dockerfile is supplied to build images, build as usual
@@ -137,7 +137,7 @@ Examples can be found [in this folder](https://github.com/zsdonghao/tensorlayer/
137137
- Data augmentation with TensorLayer, see [tutorial\_image_preprocess.py](https://github.com/zsdonghao/tensorlayer/blob/master/example/tutorial_image_preprocess.py).
138138
- Float 16 half-precision model, see [tutorial\_mnist_float16.py](https://github.com/zsdonghao/tensorlayer/blob/master/example/tutorial_mnist_float16.py)
139139
- Distributed Training. [mnist](https://github.com/zsdonghao/tensorlayer/blob/master/example/tutorial_mnist_distributed.py) and [imagenet](https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_imagenet_inceptionV3_distributed.py) by [jorgemf](https://github.com/jorgemf).
140-
140+
141141
## Vision
142142
- ArcFace: Additive Angular Margin Loss for Deep Face Recognition, see [InsignFace](https://github.com/auroua/InsightFace_TF).
143143
- BinaryNet. Model acceleration, see [mnist](https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_binarynet_mnist_cnn.py) [cifar10](https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_binarynet_cifar10_tfrecord.py).
@@ -159,7 +159,7 @@ Examples can be found [in this folder](https://github.com/zsdonghao/tensorlayer/
159159
- [Super Resolution GAN](https://arxiv.org/abs/1609.04802) by [zsdonghao](https://github.com/zsdonghao/SRGAN).
160160
- [BEGAN: Boundary Equilibrium Generative Adversarial Networks](http://arxiv.org/abs/1703.10717) by [2wins](https://github.com/2wins/BEGAN-tensorlayer).
161161
- [DAGAN: Fast Compressed Sensing MRI Reconstruction](https://github.com/nebulaV/DAGAN) by [nebulaV](https://github.com/nebulaV/DAGAN).
162-
162+
163163
## Natural Language Processing
164164
- Recurrent Neural Network (LSTM). Apply multiple LSTM to PTB dataset for language modeling, see [tutorial_ptb_lstm.py](https://github.com/zsdonghao/tensorlayer/blob/master/example/tutorial_ptb_lstm.py) and [tutorial\_ptb\_lstm\_state\_is_tuple.py](https://github.com/zsdonghao/tensorlayer/blob/master/example/tutorial_ptb_lstm_state_is_tuple.py).
165165
- Word Embedding (Word2vec). Train a word embedding matrix, see [tutorial\_word2vec_basic.py](https://github.com/zsdonghao/tensorlayer/blob/master/example/tutorial\_word2vec_basic.py).

docs/requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
flake8-docstrings>=1.3,<1.4
22
matplotlib>=2.2,<2.3
3-
pymongo>=3.6,<3.7
4-
progressbar2>=3.37,<3.38
5-
scikit-image>=0.13,<0.14
6-
scipy>=1.0,<1.1
73
sphinx>=1.7,<1.8

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ matplotlib>=2.2,<2.3
22
numpy>=1.14,<1.15
33
progressbar2>=3.37,<3.38
44
scikit-image>=0.13,<0.14
5-
scipy>=1.0,<1.1
6-
imageio>=2.3,<2.4
5+
scipy>=1.1,<1.2
6+
imageio>=2.3,<2.4

requirements_db.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pymongo>=3.6,<3.7

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def req_file(filename):
5757
extras_require = {
5858
'tf_cpu': ['tensorflow>=1.8.0,<1.9'],
5959
'tf_gpu': ['tensorflow-gpu>=1.8.0,<1.9'],
60+
'db': req_file("requirements_db.txt"),
6061
'dev': req_file("requirements_dev.txt"),
6162
'doc': req_file("docs/requirements.txt"),
6263
'test': req_file("tests/requirements.txt")

tensorlayer/__init__.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,7 @@
33
"""Deep learning and Reinforcement learning library for Researchers and Engineers"""
44
from __future__ import absolute_import
55

6-
import pkg_resources
7-
installed_packages = [d for d in pkg_resources.working_set]
8-
9-
TF_is_installed = False
10-
TL_is_installed = False
11-
12-
for package in installed_packages:
13-
if 'tensorflow' in package.project_name:
14-
TF_is_installed = True
15-
if 'tensorlayer' in package.project_name and 'site-packages' in package.location:
16-
TL_is_installed = True
17-
18-
if TF_is_installed: # The tensorlayer package is installed
6+
try:
197
import tensorflow
208

219
from . import activation
@@ -38,9 +26,14 @@
3826
global_flag = {}
3927
global_dict = {}
4028

41-
elif TL_is_installed:
42-
install_instr = "Please make sure you install a recent enough version of TensorFlow."
43-
raise ImportError("__init__.py : Could not import TensorFlow. {}".format(install_instr))
29+
except Exception as e:
30+
31+
import pkg_resources
32+
installed_packages = [d for d in pkg_resources.working_set]
33+
34+
for package in installed_packages:
35+
if 'tensorlayer' in package.project_name and 'site-packages' in package.location:
36+
raise ImportError("__init__.py : Could not import TensorLayer.\nError: {}".format(e))
4437

4538
# Use the following formating: (major, minor, patch, prerelease)
4639
VERSION = (1, 8, 5, 'rc2')

0 commit comments

Comments
 (0)