You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2021/06/08 13:49:21 UTC

[incubator-datalab] 02/03: [DATALAB-2414]: fixed rstudio virtualenv errors

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-2414
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 7ba3184ee387f093844f155bdacf82d962a29036
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Jun 8 10:53:16 2021 +0300

    [DATALAB-2414]: fixed rstudio virtualenv errors
---
 .../src/general/lib/os/debian/notebook_lib.py                      | 2 --
 infrastructure-provisioning/src/general/lib/os/fab.py              | 7 +++++--
 .../src/rstudio/scripts/configure_rstudio_node.py                  | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
index 4bcd2d9..8396256 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
@@ -256,8 +256,6 @@ def ensure_python3_libraries(os_user):
             #manage_pkg('-y install', 'remote', 'python3-setuptools')
             manage_pkg('-y install', 'remote', 'python3-pip')
             manage_pkg('-y install', 'remote', 'libkrb5-dev')
-            #datalab.fab.conn.sudo('add-apt-repository ppa:deadsnakes/ppa')
-            #manage_pkg('-y install', 'remote', 'libpython3.7-dev')
             datalab.fab.conn.sudo('pip3 install -U keyrings.alt backoff')
             datalab.fab.conn.sudo('pip3 install setuptools=={}'.format(os.environ['notebook_setuptools_version']))
             try:
diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index 43759b0..80f10fd 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -43,10 +43,13 @@ def ensure_python_venv(python_venv_version):
         if not exists(conn, '/opt/python/python{}'.format(python_venv_version)):
             conn.sudo('wget https://www.python.org/ftp/python/{0}/Python-{0}.tgz -O /tmp/Python-{0}.tgz'.format(python_venv_version))
             conn.sudo('tar zxvf /tmp/Python-{}.tgz -C /tmp/'.format(python_venv_version))
-            conn.sudo('''bash -l -c 'cd /tmp/Python-{0} && ./configure --prefix=/opt/python/python{0} --with-zlib-dir=/usr/local/lib/ --with-ensurepip=install' '''.format(python_venv_version))
+            conn.sudo('''bash -l -c 'cd /tmp/Python-{0} && ./configure --prefix=/opt/python/python{0} 
+            --with-zlib-dir=/usr/local/lib/ --with-ensurepip=install --enable-shared' '''.format(python_venv_version))
             conn.sudo('''bash -l -c 'cd /tmp/Python-{0} && make altinstall' '''.format(python_venv_version))
             conn.sudo('''bash -l -c 'cd /tmp && rm -rf Python-{}' '''.format(python_venv_version))
-            conn.sudo('virtualenv /opt/python/python{}'.format(python_venv_version))
+            conn.sudo(
+                '''bash -l -c 'echo "export LD_LIBRARY_PATH=/opt/python/python{}/lib" >> /etc/profile' '''.format(python_venv_version))
+            conn.sudo('''bash -l -c 'virtualenv /opt/python/python{0}' '''.format(python_venv_version))
             venv_command = 'source /opt/python/python{}/bin/activate'.format(python_venv_version)
             pip_command = '/opt/python/python{0}/bin/pip{1}'.format(python_venv_version, python_venv_version[:3])
             conn.sudo('''bash -l -c '{0} && {1} install -U pip=={2}' '''.format(venv_command, pip_command, os.environ['conf_pip_version']))
diff --git a/infrastructure-provisioning/src/rstudio/scripts/configure_rstudio_node.py b/infrastructure-provisioning/src/rstudio/scripts/configure_rstudio_node.py
index 9ea4f12..9cf8d98 100644
--- a/infrastructure-provisioning/src/rstudio/scripts/configure_rstudio_node.py
+++ b/infrastructure-provisioning/src/rstudio/scripts/configure_rstudio_node.py
@@ -92,7 +92,7 @@ if __name__ == "__main__":
 
     # INSTALL PYTHON IN VIRTUALENV
     print("Configure Python Virtualenv")
-    #ensure_python_venv(python_venv_version)
+    ensure_python_venv(python_venv_version)
 
     # INSTALL RSTUDIO
     print("Install RStudio")

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org