From 0ab08f9081cb71c807de8f710f29880e7ac8c509 Mon Sep 17 00:00:00 2001 From: Yasser Elsayed Date: Wed, 11 Jan 2017 21:48:46 -0800 Subject: [PATCH 1/3] add tensorflow and cloudml in setup.py to make the lib pip-installable --- setup.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/setup.py b/setup.py index e9b464f5a..a009cff46 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,9 @@ # To publish to PyPi use: python setup.py bdist_wheel upload -r pypi import datetime +import platform from setuptools import setup +import pip minor = datetime.datetime.now().strftime("%y%m%d%H%M") version = '0.1.' + minor @@ -104,3 +106,22 @@ ] } ) + +tensorflow_path = None +if platform.system() == 'Darwin': + tensorflow_path = 'https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0-py2-none-any.whl' +elif platform.system() == 'Linux': + if platform.linux_distribution()[0] == 'Ubuntu': + tensorflow_path = 'https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl' + elif platform.linux_distribution()[0] == 'Debian': + tensorflow_path = 'https://storage.googleapis.com/tensorflow/linux/cpu/debian/jessie/tensorflow-0.11.0-cp27-none-linux_x86_64.whl' + +# install tensorflow +if not tensorflow_path: + print """Warning: could not find tensorflow build for your OS. + Please go to https://www.tensorflow.org/get_started/os_setup to see install options""" +else: + pip.main(['install', tensorflow_path]) + +# install cloud ml sdk +pip.main(['install', 'https://storage.googleapis.com/cloud-ml/sdk/cloudml.latest.tar.gz']) From 4c3bc2c4c6e315866c637924f09d571b84baa729 Mon Sep 17 00:00:00 2001 From: Yasser Elsayed Date: Wed, 11 Jan 2017 23:10:58 -0800 Subject: [PATCH 2/3] update setuptools to fix pip install bug --- .travis.yml | 3 ++- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3f210d6b..7fd31d7c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ language: python python: - "2.7" - - "3.4" before_install: + - sudo apt-get install -y python-setuptools - npm install -g typescript - tsc --module amd --noImplicitAny --outdir datalab/notebook/static datalab/notebook/static/*.ts - pip install -U pip + - pip install -U setuptools - pip install . script: python ./tests/main.py diff --git a/setup.py b/setup.py index a009cff46..a6ce4e52f 100644 --- a/setup.py +++ b/setup.py @@ -118,8 +118,8 @@ # install tensorflow if not tensorflow_path: - print """Warning: could not find tensorflow build for your OS. - Please go to https://www.tensorflow.org/get_started/os_setup to see install options""" + print("""Warning: could not find tensorflow build for your OS. + Please go to https://www.tensorflow.org/get_started/os_setup to see install options""") else: pip.main(['install', tensorflow_path]) From 780320c5a136082a768f4cd4c028d7ae2375dd7e Mon Sep 17 00:00:00 2001 From: Yasser Elsayed Date: Thu, 12 Jan 2017 16:14:18 -0800 Subject: [PATCH 3/3] add python3 back --- .travis.yml | 3 ++- setup.py | 41 +++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7fd31d7c1..adc180ab2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python python: - - "2.7" + - 2.7 + - 3.5 before_install: - sudo apt-get install -y python-setuptools diff --git a/setup.py b/setup.py index a6ce4e52f..b0c4a18f9 100644 --- a/setup.py +++ b/setup.py @@ -13,9 +13,12 @@ # To publish to PyPi use: python setup.py bdist_wheel upload -r pypi import datetime -import platform +import sys from setuptools import setup -import pip + +if sys.version_info[0] == 2: + import platform + import pip minor = datetime.datetime.now().strftime("%y%m%d%H%M") version = '0.1.' + minor @@ -107,21 +110,23 @@ } ) -tensorflow_path = None -if platform.system() == 'Darwin': - tensorflow_path = 'https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0-py2-none-any.whl' -elif platform.system() == 'Linux': - if platform.linux_distribution()[0] == 'Ubuntu': - tensorflow_path = 'https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl' - elif platform.linux_distribution()[0] == 'Debian': - tensorflow_path = 'https://storage.googleapis.com/tensorflow/linux/cpu/debian/jessie/tensorflow-0.11.0-cp27-none-linux_x86_64.whl' +# for python2 only, install tensorflow and cloudml +if sys.version_info[0] == 2: + tensorflow_path = None + if platform.system() == 'Darwin': + tensorflow_path = 'https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0-py2-none-any.whl' + elif platform.system() == 'Linux': + if platform.linux_distribution()[0] == 'Ubuntu': + tensorflow_path = 'https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl' + elif platform.linux_distribution()[0] == 'Debian': + tensorflow_path = 'https://storage.googleapis.com/tensorflow/linux/cpu/debian/jessie/tensorflow-0.11.0-cp27-none-linux_x86_64.whl' -# install tensorflow -if not tensorflow_path: - print("""Warning: could not find tensorflow build for your OS. - Please go to https://www.tensorflow.org/get_started/os_setup to see install options""") -else: - pip.main(['install', tensorflow_path]) + # install tensorflow + if not tensorflow_path: + print("""Warning: could not find tensorflow build for your OS. + Please go to https://www.tensorflow.org/get_started/os_setup to see install options""") + else: + pip.main(['install', tensorflow_path]) -# install cloud ml sdk -pip.main(['install', 'https://storage.googleapis.com/cloud-ml/sdk/cloudml.latest.tar.gz']) + # install cloud ml sdk + pip.main(['install', 'https://storage.googleapis.com/cloud-ml/sdk/cloudml.latest.tar.gz'])