Ricks-Lab / gpu-utils

A set of utilities for monitoring and customizing GPU performance
GNU General Public License v3.0
136 stars 23 forks source link

Add remote installation instruction #97

Closed csecht closed 3 years ago

csecht commented 4 years ago

When installing via PyPI to a remoted machine, I ran into several permission errors and a failed installation unless I used sudo with pip3 install.

Ricks-Lab commented 4 years ago

You should not need sudo for pip install. It should install under the user's home directory. Here is my output for which gpu-ls:

rick@Eos:~$ which gpu-ls
/home/rick/.local/bin/gpu-ls

Perhaps you had pip installed something in the past using sudo. Maybe it would be best to check ownership of files and directories under your .local directory.

csecht commented 3 years ago

On my local machine, yes, that’s the path. But on my remote machine the path is /usr/local/bin/gpu-ls.
I assumed that’s because the remote pip install was done using a ssh connection? When logged in remotely over ssh, a pip install without the sudo raises a PermissionError: [Errno 113] Permission denied: ‘/home/craig/.local/lib/python3.6’.

On Sep 6, 2020, at 7:31 PM, Rick notifications@github.com wrote:

You should not need sudo for pip install. It should install under the user's home directory. Here is my output for which gpu-ls:

rick@Eos:~$ which gpu-ls /home/rick/.local/bin/gpu-ls Perhaps you had pip installed something in the past using sudo. Maybe it would be best to check ownership of files and directories under your .local directory.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ricks-Lab/gpu-utils/pull/97#issuecomment-687947756, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMVCQQYG5HAFEOWG7EJSOTSEQSWNANCNFSM4Q474NZQ.

Ricks-Lab commented 3 years ago

Still not sure it is the best approach, but since you qualify the statement by indicating it is only valid with ssh remote access. I wonder if there is a better way to assure you use your normal environment with an ssh login. I have recently been working to better understand ssh and ssh with a YubiKey. I have found and fixed an issue of a runtime error with ssh x related permission issue. So calling Gtk.init_check to exit gracefully for this condition. But I am still have issues on a robust setup for ssh with X-forwarding. Can you recommend good reference material?

csecht commented 3 years ago

I set up my remote machine as the ssh server. This was a couple of years ago, but my notes from that are pasted below. For this posting, the name of my remote machine, the key fingerprint, and the key's ramdomart image have been edited. There not much I remember about it all, so once you read the notes you'll know as much as I (sad but true). What I do remember is that recently I made an alias for the ssh -X login command line, because I could never remember the full name of my remote machine (that's another story). craig-Linux2 is my local machine, the ssh client. My remote is headless, but I had a monitor hooked up to it for the first step. My notes....

good info at:

https://linuxhandbook.com/enable-ssh-ubuntu/ https://linuxhandbook.com/ssh-basics/

Will need to remote command the my-remote 'server', so log on to the remove machine and

install server software, because service nor systemctrl is installed

sudo apt-get install openssh-server

then:

sudo service ssh start

From my local machine

craig@craig-Linux2:~$ sudo ssh craig@my-remote.local
craig@my-remote.local's password: 
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-43-generic x86_64)
.................

craig@my-remote:~$ 

Use ctrl-d to logout of ssh

+++++++++++++++++++++++

Better yet, set up automatic ssh login with permission keys:

https://help.ubuntu.com/community/SSH/OpenSSH/Keys

craig@craig-Linux2:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/craig/.ssh/id_rsa): /home/craig/.ssh/id_rsa
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/craig/.ssh/id_rsa.
Your public key has been saved in /home/craig/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:...yaddayadda... craig@craig-Linux2
The key's randomart image is:
+---[RSA 2048]----+
|.+.+ .+.. . o..  |
  ...and so on...
+----[SHA256]-----+

craig@craig-Linux2:~$ ssh-copy-id craig@my-remote.local

!!!!THAT"S IT!!!! Need the .local bit.

Then log into remote from local machine with:

craig@craig-Linux2:~$ ssh -X craig@my-remote.local

The -X is for X-11 forwarding, which allows gui programs to run on local display. So cool.