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.03k stars 339 forks source link

The /opt/tljh/user environment isn't activated in terminals - /opt/anaconda3 is used #626

Open PaleNeutron opened 3 years ago

PaleNeutron commented 3 years ago

Bug description

After installing, I found python in notebook is:

import sys
print(sys.path)

['/home/jupyter-john',
 '/opt/tljh/user/lib/python37.zip',
 '/opt/tljh/user/lib/python3.7',
 '/opt/tljh/user/lib/python3.7/lib-dynload',
 '',
 '/opt/tljh/user/lib/python3.7/site-packages',
 '/opt/tljh/user/lib/python3.7/site-packages/IPython/extensions',
 '/home/jupyter-john/.ipython']

while the default python in terminal is:

jupyter-john@klfy-Z10PE-D8-WS:~$ which python
/opt/anaconda3/bin/python

Is there some config wrong? How can I fix that.

Expected behaviour

notebook and terminal use same python

Actual behaviour

notebook use tljh python and terminal use conda python

How to reproduce

I'm not sure, I just install it using bootstrap.py.

But I have an existing conda installed before tljh

Your personal set up

sudo tljh-config show
users:
  admin:
  - john
auth:
  type: nativeauthenticator.NativeAuthenticator
  NativeAuthenticator:
    open_signup: true
  FirstUseAuthenticator:
    create_users: true

install.log

2020-10-27 17:23:16,429 Checking if TLJH is already installed...
2020-10-27 17:23:16,429 Setting up hub environment
2020-10-27 18:12:02,834 Checking if TLJH is already installed...
2020-10-27 18:12:02,834 Setting up hub environment
2020-10-27 18:12:31,273 Installed python & virtual environment
2020-10-27 18:12:32,677 Set up hub virtual environment
2020-10-27 18:12:32,677 Setting up TLJH installer...
2020-10-27 18:12:42,788 Upgraded pip
2020-10-27 18:16:30,446 Checking if TLJH is already installed...
2020-10-27 18:16:30,446 TLJH already installed, upgrading...
2020-10-27 18:16:30,446 Upgrading TLJH installer...
2020-10-27 18:16:32,400 Upgraded pip
2020-10-27 18:16:45,767 Setup tljh package
2020-10-27 18:16:45,768 Starting TLJH installer...
2020-10-27 18:16:46,024 Setting up admin users
2020-10-27 18:16:46,070 Granting passwordless sudo to JupyterHub admins...
2020-10-27 18:16:46,071 Setting up user environment...
2020-10-27 18:16:46,076 Downloading & setting up user environment...
2020-10-27 18:23:07,855 Setting up JupyterHub...
2020-10-27 18:25:59,455 Waiting for JupyterHub to come up (1/20 tries)
2020-10-27 18:25:59,465 Done!
welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

robaru commented 3 years ago

@PaleNeutron PaleNeutron a simple workaround is to activate, from a system terminal, the tljh's environment with source /opt/tljh/user/bin/activate

and to use conda from there.

Since I do not have conda installed systemwide, during the installation process, tljh installed its local version of anaconda. Probably you have the same issue. :)

isaprykin commented 3 months ago
$ cat /etc/profile.d/source-jupyter.sh 
#!/bin/bash
source /opt/tljh/user/bin/activate