Make Python3.7 default and upgrade conda

This commit is contained in:
GeorgianaElena
2019-09-18 16:36:52 +03:00
parent 18eda64e53
commit a659d1b48a
2 changed files with 19 additions and 8 deletions

View File

@@ -113,7 +113,11 @@ def main():
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
logger.info('Checking if TLJH is already installed...') logger.info('Checking if TLJH is already installed...')
python3_version = "python3"
if os.path.exists(os.path.join(hub_prefix, 'bin', 'python3')): if os.path.exists(os.path.join(hub_prefix, 'bin', 'python3')):
# Check if the existing install is under Python3.7
if os.path.exists(os.path.join(hub_prefix, 'bin', 'python3.7')):
python3_version = "python3.7"
logger.info('TLJH already installed, upgrading...') logger.info('TLJH already installed, upgrading...')
initial_setup = False initial_setup = False
else: else:
@@ -130,14 +134,15 @@ def main():
run_subprocess(['apt-get', 'update', '--yes']) run_subprocess(['apt-get', 'update', '--yes'])
run_subprocess(['apt-get', 'install', '--yes', run_subprocess(['apt-get', 'install', '--yes',
'python3', 'python3.7',
'python3-venv', 'python3.7-venv',
'python3.7-dev',
'python3-pip', 'python3-pip',
'git' 'git'
]) ])
logger.info('Installed python & virtual environment') logger.info('Installed python & virtual environment')
os.makedirs(hub_prefix, exist_ok=True) os.makedirs(hub_prefix, exist_ok=True)
run_subprocess(['python3', '-m', 'venv', hub_prefix]) run_subprocess(['python3.7', '-m', 'venv', hub_prefix])
logger.info('Set up hub virtual environment') logger.info('Set up hub virtual environment')
if initial_setup: if initial_setup:
@@ -161,9 +166,9 @@ def main():
logger.info('Starting TLJH installer...') logger.info('Starting TLJH installer...')
os.execv( os.execv(
os.path.join(hub_prefix, 'bin', 'python3'), os.path.join(hub_prefix, 'bin', python3_version),
[ [
os.path.join(hub_prefix, 'bin', 'python3'), os.path.join(hub_prefix, 'bin', python3_version),
'-m', '-m',
'tljh.installer', 'tljh.installer',
] + sys.argv[1:] ] + sys.argv[1:]

View File

@@ -237,6 +237,12 @@ def ensure_user_environment(user_requirements_txt_file):
Set up user conda environment with required packages Set up user conda environment with required packages
""" """
logger.info("Setting up user environment...") logger.info("Setting up user environment...")
if "python3.7" in sys.executable:
conda_version = '4.7.5'
miniconda_version = '4.7.5'
miniconda_installer_md5 = "fc3595e7a66cf159a9d288a212834127"
else:
conda_version = '4.5.8'
miniconda_version = '4.5.4' miniconda_version = '4.5.4'
miniconda_installer_md5 = "a946ea1d0c4a642ddf0c3a26a18bb16d" miniconda_installer_md5 = "a946ea1d0c4a642ddf0c3a26a18bb16d"
@@ -247,7 +253,7 @@ def ensure_user_environment(user_requirements_txt_file):
conda.ensure_conda_packages(USER_ENV_PREFIX, [ conda.ensure_conda_packages(USER_ENV_PREFIX, [
# Conda's latest version is on conda much more so than on PyPI. # Conda's latest version is on conda much more so than on PyPI.
'conda==4.5.8' 'conda==' + conda_version
]) ])
conda.ensure_pip_packages(USER_ENV_PREFIX, [ conda.ensure_pip_packages(USER_ENV_PREFIX, [