0

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?

user40780
  • 1,828
  • 7
  • 29
  • 50

1 Answers1

1

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.

Warkaz
  • 845
  • 6
  • 18
  • Thanks! The issue is actually that root user cannot don't have the PATH parameter for Jupiter. But I think `sudo nice -n -1 su -c ` is the ultimate solution. Do you know how to put my commands there? Like `sudo nice -n -1 su -c jupyter notebook --ip 0.0.0.0 --port 8888 my username ` ? Thanks! – user40780 Sep 16 '22 at 19:57
  • @user40780 `sudo nice -n -1 su -c "jupyter notebook --ip 0.0.0.0 --port 8888" ` sounds right to me, but would have to activate environment with the appropriate knowledge of `jupyter`. Maybe `sudo nice -n -1 su -c "conda activate && jupyter notebook --ip 0.0.0.0 --port 8888" ` – Warkaz Sep 17 '22 at 11:38