mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Merge pull request #433 from GeorgianaElena/upgradePython
Make Python3.7 the default
This commit is contained in:
54
docs/howto/env/user-environment.rst
vendored
54
docs/howto/env/user-environment.rst
vendored
@@ -153,3 +153,57 @@ The most common & portable way to fix this when using ``ssh`` is:
|
||||
.. code-block:: bash
|
||||
|
||||
sudo PATH=${PATH} conda install -c conda-forge gdal
|
||||
|
||||
|
||||
Upgrade to a newer Python version
|
||||
=================================
|
||||
|
||||
All new TLJH installs use miniconda 4.7.10, which comes with a Python 3.7
|
||||
environment for the users. The previously TLJH installs came with miniconda 4.5.4,
|
||||
which meant a Python 3.6 environment.
|
||||
|
||||
To upgrade the Python version of the user environment, one can:
|
||||
|
||||
* **Start fresh on a machine that doesn't have TLJH already installed.**
|
||||
|
||||
See the :ref:`installation guide <install/installing>` section about how to install TLJH.
|
||||
|
||||
* **Upgrade Python manually.**
|
||||
|
||||
Because upgrading Python for existing installs can break packages alaredy installed
|
||||
under the old Python, upgrading your current TLJH installation, will NOT upgrade
|
||||
the Python version of the user environment, but you may do so manually.
|
||||
|
||||
**Steps:**
|
||||
|
||||
1. Activate the user environment, if using ssh.
|
||||
If the terminal was started with JupyterHub, this step can be skipped:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
source /opt/tljh/user/bin/activate
|
||||
|
||||
2. Get the list of currently installed pip packages (so you can later install them under the
|
||||
new Python):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip freeze > pip_pkgs.txt
|
||||
|
||||
3. Update all conda installed packages in the environment:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo PATH=${PATH} conda update --all
|
||||
|
||||
4. Update Python version:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo PATH=${PATH} conda install python=3.7
|
||||
|
||||
5. Install the pip packages previously saved:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install -r pip_pkgs.txt
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.. _install/installing:
|
||||
|
||||
==========
|
||||
Installing
|
||||
==========
|
||||
|
||||
@@ -13,13 +13,13 @@ def prefix():
|
||||
"""
|
||||
Provide a temporary directory with a conda environment
|
||||
"""
|
||||
miniconda_version = '4.5.4'
|
||||
miniconda_installer_md5 = "a946ea1d0c4a642ddf0c3a26a18bb16d"
|
||||
miniconda_version = '4.7.10'
|
||||
miniconda_installer_md5 = "1c945f2b3335c7b2b15130b1b2dc5cf4"
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with conda.download_miniconda_installer(miniconda_version, miniconda_installer_md5) as installer_path:
|
||||
conda.install_miniconda(installer_path, tmpdir)
|
||||
conda.ensure_conda_packages(tmpdir, [
|
||||
'conda==4.5.8'
|
||||
'conda==4.8.1'
|
||||
])
|
||||
yield tmpdir
|
||||
|
||||
|
||||
@@ -237,17 +237,25 @@ def ensure_user_environment(user_requirements_txt_file):
|
||||
Set up user conda environment with required packages
|
||||
"""
|
||||
logger.info("Setting up user environment...")
|
||||
miniconda_version = '4.5.4'
|
||||
miniconda_installer_md5 = "a946ea1d0c4a642ddf0c3a26a18bb16d"
|
||||
|
||||
if not conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_version):
|
||||
miniconda_old_version = '4.5.4'
|
||||
miniconda_new_version = '4.7.10'
|
||||
conda_version = '4.5.8'
|
||||
|
||||
# If no prior miniconda installation is found, we can install a newer version
|
||||
if not conda.check_miniconda_version(
|
||||
USER_ENV_PREFIX, miniconda_old_version
|
||||
) and not conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_new_version):
|
||||
miniconda_installer_md5 = "1c945f2b3335c7b2b15130b1b2dc5cf4"
|
||||
conda_version = '4.8.1'
|
||||
|
||||
logger.info('Downloading & setting up user environment...')
|
||||
with conda.download_miniconda_installer(miniconda_version, miniconda_installer_md5) as installer_path:
|
||||
with conda.download_miniconda_installer(miniconda_new_version, miniconda_installer_md5) as installer_path:
|
||||
conda.install_miniconda(installer_path, USER_ENV_PREFIX)
|
||||
|
||||
conda.ensure_conda_packages(USER_ENV_PREFIX, [
|
||||
# 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, [
|
||||
|
||||
Reference in New Issue
Block a user