Compile Python 3.6 from source on Ubuntu.
The deadsnakes packages have some issues with pip not working and
conflicting with the python3-pip package.
diff --git a/buildkite/install-python36.sh b/buildkite/install-python36.sh
index f65c5ff..3c7e74a 100755
--- a/buildkite/install-python36.sh
+++ b/buildkite/install-python36.sh
@@ -14,10 +14,42 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-add-apt-repository -y "ppa:deadsnakes/ppa"
-apt-get -qqy update > /dev/null
-apt-get -qqy install python3.6 python3.6-dev python3.6-venv > /dev/null
-python3.6 -m ensurepip
+# add-apt-repository -y "ppa:deadsnakes/ppa"
+# apt-get -qqy update > /dev/null
+# apt-get -qqy install python3.6 python3.6-dev python3.6-venv > /dev/null
+# python3.6 -m ensurepip
+# rm -f /usr/local/bin/pip3
+# apt-get -qqy install python3-pip
+# pip3.6 install requests pyyaml
+# pip3.6 install --pre github3.py
-pip3.6 install requests pyyaml
+apt-get -qqy install zlib1g-dev libssl-dev
+
+PYTHON_VERSION="3.6.4"
+
+mkdir -p /usr/local/src
+pushd /usr/local/src
+
+curl -O "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz"
+tar xvfJ "Python-${PYTHON_VERSION}.tar.xz"
+rm -f "Python-${PYTHON_VERSION}.tar.xz"
+cd "Python-${PYTHON_VERSION}"
+
+# Enable the 'ssl' module.
+cat >> Modules/Setup.dist <<'EOF'
+_ssl _ssl.c \
+ -DUSE_SSL -I/usr/include -I/usr/include/openssl \
+ -L/usr/lib -lssl -lcrypto
+EOF
+
+echo "Compiling Python ${PYTHON_VERSION} ..."
+./configure --enable-ipv6
+make -s -j8 all > /dev/null
+echo "Installing Python ${PYTHON_VERSION} ..."
+make -s altinstall > /dev/null
+
+pip3.6 install requests uritemplate pyyaml
pip3.6 install --pre github3.py
+
+popd
+rm -rf "/usr/local/src/Python-${PYTHON_VERSION}"
diff --git a/buildkite/setup-ubuntu.sh b/buildkite/setup-ubuntu.sh
index 9bbca14..a07b1a4 100755
--- a/buildkite/setup-ubuntu.sh
+++ b/buildkite/setup-ubuntu.sh
@@ -33,8 +33,14 @@
git
python
python-dev
+ python-mock
+ python-numpy
+ python-pip
python3
python3-dev
+ python3-mock
+ python3-numpy
+ python3-pip
realpath
unzip
wget
@@ -53,10 +59,6 @@
# Dependencies for TensorFlow.
libcurl3-dev
- python-mock
- python-numpy
- python3-mock
- python3-numpy
swig
)
apt-get -qqy install "${packages[@]}" > /dev/null