NVlabs / PoseCNN-PyTorch

PyTorch implementation of the PoseCNN framework
Other
186 stars 47 forks source link

Need for sudo for compiling layers #17

Open SelvamArul opened 2 years ago

SelvamArul commented 2 years ago

In the install instructions (instruction no.6) , for compiling the new layers, the following command is suggested.

cd $ROOT/lib/layers
sudo python setup.py install

Is there any reason for using sudo here? Using sudo python will invoke the superuser's python.

(py3.8) xxx@yyy:~/workspace/PoseCNN-PyTorch$ which python
/home/user/xxx/anaconda3/envs/py3.8/bin/python
(py3.8) xxx@yyy:~/workspace/PoseCNN-PyTorch$ sudo which python
/usr/bin/python

IMO using sudo here is not just superfluous but also erroneous. Can we remove the sudo in the install instruction?

eneserdo commented 2 years ago

I used as sudo /path/to/specific/python setup.py install

wetoo-cando commented 11 months ago

@SelvamArul you are right.

I think what happened here is that the author of this repo probably compiled some things either with sudo (or may be he was inside docker and operating with root permissions). This created some intermediate dirs during compilation with root rights only. Then these intermediate dirs got pushed to the repo and now all users have them on their machines after cloning the repo. If you try to build without sudo, it tries to write to these dirs (or overwrite them) but obviously cannot.

I solved this by first running sudo /path/to/specific/python setup.py install as suggested above. The console log then shows which intermediate dirs are created (there are a few under lib\layers and one under the site-packages of my virtualenv. Then I deleted those dirs with sudo rm -rf <dir>(only possible if you have root rights). Once I had cleaned the directory tree this way, I could run the above command without needing sudo.

So it would help users if the author (@yuxng ?) could purge the repo of dirs with root permissions and re-commit. This way also users who do not have root rights on their machines can use the repo also (without needing docker).

Or I'll try to create a pull request if I can find the time.