!pip install occur permission problem in notebook

jupyter hub:1.4.2
jupyter notebook:6.4.3
python:3.6

common user installs some package with ‘!pip install packagename’, the page displays permission problems, like **/bin folder needs root privilege.
fo now i can only login in the jupyter hub server using root user to install that package.

You aren’t providing much to go on here. Are you the admin? Did you set up the Jupyterhub? Is it the Littlest JupyterHub and you’ve looked here and in the documentation? Checked the other JupyterHub ‘permission’ topic posts and tried or provided what was typically asked there?


Also, in case you aren’t aware, as a typical user, you should be using the %pip install and %conda install magics. It is better than the outdated !pip install route for typical users. See Pythonic Perambulations - Installing Python Packages from a Jupyter Notebook: New Jupyter Magic Functions and additional resources in my recent post here.


Any chance %pip install or %conda install works without the issue?

1 Like

yes, it’s the littlest jupyter hub, the users created not belong to admin group. the authorization use ldapauthenticator that will create unix user. Does the ldap user created need root privilege , it will call security problem.

 def add_system_user(self, username, password):
        res = os.system('useradd  %(name1)s -s /bin/nologin' % {'name1': username})
        if res:
            self.log.warn('user %s create failure' % username)
            return False
        res = os.system('echo %(pass)s |passwd --stdin %(name1)s' % {'name1': username, 'pass': password})
        if res:
            self.log.warn('user %s password create failure' % username)
            return False
        return True