jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.04k stars 341 forks source link

Installation failure on fresh Ubuntu 18.04 #526

Closed drjarno closed 3 years ago

drjarno commented 4 years ago

I created a fresh VM with 18.04 and ran apt full-upgrade to install the latest updates.

Then I tried to install Jupyter Hub by following the installation instructions: sudo apt install python3 python3-dev git curl

curl https://raw.githubusercontent.com/jupyterhub/the-littlest- 
jupyterhub/master/bootstrap/bootstrap.py | sudo -E python3 - --admin jarno

Unfortunately, this failed with the following error:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6354  100  6354    0     0  38277      0 --:--:-- --:--:-- --:--:-- 38277
Checking if TLJH is already installed...
Setting up hub environment
Installed python & virtual environment
Set up hub virtual environment
Setting up TLJH installer...
Setup tljh package
Starting TLJH installer...
Setting up admin users
Granting passwordless sudo to JupyterHub admins...
Setting up user environment...
Downloading & setting up user environment...
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 508, in <module>
    main()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 491, in main
    ensure_user_environment(args.user_requirements_txt_url)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 272, in 
ensure_user_environment
    'conda==' + conda_version
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/conda.py", line 109, in 
ensure_conda_packages
    ] + packages).decode()
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/opt/tljh/user/bin/python', '-m', 'conda', 'install', '-c', 
'conda-forge', '--json', '--prefix', '/opt/tljh/user', 'conda==4.8.1']' returned non-zero exit status 1.

I noticed that conda was only at version 4.7.10, so I updated with

sudo -E /opt/tljh/user/bin/python -m conda update --all

After that, I ran the install command again and this time it worked. I hope this workaround will help you to figure out why the install scripts fails on a fresh Ubuntu 18.04 VM.

nmvega commented 4 years ago

@drjarno I had the same issue, but the cause was different. When you happen to install conda (in my case Miniconda3, it interferes with the TLJH installer. That's because, although parts of the installer does indeed use it's internal virtual environment python -- i.e. /opt/tljh/user/bin/python -- as that installer downloads additional components to installs them, if it happens to find your external conda (i.e. find it first in the PATH), then it will cause conflict and crash exactly as above.

I ended up removing conda completely (100%) and am using straight python to intall TLJH until I can figure out how to get the TLJH installer to reliably work with conda installed side-by-side.

P.S. I tried @drjarno update solution, but the failure remained because it kept finding my conda's python.

EDIT (UPDATE): I figured out how to overcome my variety of this issue.

I always install conda in /opt/conda.d/. To avoid my version of this problem, I dynamically (temporarily) remove /opt/conda.d/bin/ from my PATH environment variable, like this:

root# export PATH='.:/root/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:'

Then I immediately run the installer using /opt/conda.d/bin/python3 (yes, the one I just removed from the PATH), like this:

root# /opt/conda.d/bin/python3 /root/tinstall.tljh.py

Now, however, since /opt/conda.d/bin/{conda, python3} aren't in my PATH environment variable, other TLJH components downloaded later on won't find them; and avoids the conflict.

And finally, once installation is complete, I recover the PATH by simply re-sourcing .profile:

root# . /root/.profile

I hope this helps, too.

ltoop commented 4 years ago

I had the error when installing on a Multipass default instance of Ubuntu LTS, with only 1GB memory. Running the command showed an error because that was not enough memory. Failed when 2GB available as well - worked at 4GB.

consideRatio commented 3 years ago

With #697, we have a very up to date version of conda/mamba so the workaround won't be needed. The mamba CLI is a high performance clone of the conda CLI.