Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip installation fails in a least-privilege system #52

Closed
luisfabib opened this issue Oct 27, 2020 · 3 comments
Closed

pip installation fails in a least-privilege system #52

luisfabib opened this issue Oct 27, 2020 · 3 comments

Comments

@luisfabib
Copy link
Member

luisfabib commented Oct 27, 2020

When trying to install DeerLab via

pip install --user deerlab

on a cluster with only user-level privileges.

The setup.py script crashes when trying to install all other dependencies in the installation script:

# Custom OS-specific installation script
def install_dependencies():
#-----------------------------------------------------------------------
    subprocess.run(['pip','install','memoization'],check=True)
    subprocess.run(['pip','install','matplotlib'],check=True)

    # Dependencies with OS-specific BLAS
    if platform.system() == 'Windows':  
        # Install Numpy,SciPy, CVXopt linked to MKL
        subprocess.run(['pip','install','pipwin'],check=True)
        subprocess.run(['pipwin','install','numpy'],check=False)
        subprocess.run(['pipwin','install','scipy'],check=False)
        subprocess.run(['pipwin','install','cvxopt'],check=False)
    else:
        # Install Numpy,SciPy, CVXopt linked to OpenBLAS
        subprocess.run(['pip','install','numpy'],check=True)
        subprocess.run(['pip','install','scipy'],check=True)
        subprocess.run(['pip','install','cvxopt'],check=True)

    subprocess.run(['pip','install','numdifftools'],check=True)
    subprocess.run(['pip','install','tqdm'],check=True)
    subprocess.run(['pip','install','joblib'],check=True)
#-----------------------------------------------------------------------    

Since pip is called without the --user flag, the installation fails due to the lack of privilege to install dependencies system-wide.

The easiest fix is to install DeerLab dependencies only at user-level not system-wide, e.g.

subprocess.run(['pip','--user','install','memoization'],check=True)

but maybe there is a more elegant way to do this.

@luisfabib luisfabib added the bug Something isn't working label Oct 27, 2020
@luisfabib luisfabib changed the title pip installation fails without higher privilege pip installation fails in a least-privilege system Oct 27, 2020
@mtessmer
Copy link
Collaborator

You should be using virtual environments on a cluster for any python project. This is not unique to DeerLab.

@luisfabib
Copy link
Member Author

I am aware of that, however, in this cluster they recommend the direct installation of packages without a virtual environment. So users without much Python expertise stumbled upon this when following the cluster documentation.

This might also be a problem in IT systems where users have limited privileges on their office computers.

@mtessmer
Copy link
Collaborator

mtessmer commented Nov 2, 2020

You should probably just let pip handle (non-pipwin) dependencies instead of explicitly installing them.

@luisfabib luisfabib removed the bug Something isn't working label Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants