Search code examples
linuxcondanice

how to nice Jupiter notebook from conda


I am trying to set less than 0 niceness value (high priority) for Jupiter notebook.

Everything is based on conda environment

Firstly, this runs without any issue:

jupyter notebook --ip 0.0.0.0 --port 8888;

I tried:

$ nice -n -1 jupyter notebook --ip 0.0.0.0 --port 8888;
nice: cannot set niceness: Permission denied

Then I tried

$ sudo nice -n -1 jupyter notebook --ip 0.0.0.0 --port 8888;
nice: ‘jupyter’: No such file or directory

Could anyone help?


Solution

  • TLDR; I think because you are giving -1 as a parameter. The Standard is 20, at least in my Linux system. Try giving it a different value, that is still positive like 1.

    nice -n 1 jupyter notebook --ip 0.0.0.0 --port 8888
    

    During my research:

    Have you tried the su command for switching users, but we will use it to execute the command with -c flag as discussed here.

    sudo nice -n -1 su -c <command_to_run> <user_to_run_as>
    

    I have tried to reproduce your error, but couldn't do it. Maybe it has to do with the fact that there are 2 different versions, bin/nice and nice from bash. Check documentation with man nice.

    I am assuming you are using Linux OS, by the use of nice command, but if anyone needs a similar thing for Windows, should look into the equivalent of nice here.