Bitcoin Forum

Bitcoin => Electrum => Topic started by: Coin-Keeper on September 03, 2020, 09:41:30 PM



Title: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 03, 2020, 09:41:30 PM
I did a PIP install this morning on a test VM.  For some reason PIP has it in /root/.local/bin/electrum.  Why in the heck did it end up in /root?

I used the simple PIP wget lines at electrum.org and confirmed via gpg and the file is good to go.  The install went perfectly as I watched it do what it is supposed to do.  I'll paste the terminal from building wheels down:

___________________--

Building wheels for collected packages: Electrum, bitstring, pyaes
  Running setup.py bdist_wheel for Electrum ... done
  Stored in directory: /root/.cache/pip/wheels/7c/cb/97/3c0a62534c52732c32fba7dc8ac9b26b36b28ef0028b7d008b
  Running setup.py bdist_wheel for bitstring ... done
  Stored in directory: /root/.cache/pip/wheels/b8/27/f0/8373e26b7de57db03dc18aaaebdd8c26a99da882416f762979
  Running setup.py bdist_wheel for pyaes ... done
  Stored in directory: /root/.cache/pip/wheels/bd/cf/7b/ced9e8f28c50ed666728e8ab178ffedeb9d06f6a10f85d6432
Successfully built Electrum bitstring pyaes
Installing collected packages: multidict, attrs, yarl, async-timeout, aiohttp, aiohttp-socks, aiorpcx, bitstring, dnspython, protobuf, pyaes, zipp, importlib-metadata, helpdev, qtpy, qdarkstyle, qrcode, Electrum
  The script helpdev is installed in '/root/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script qdarkstyle is installed in '/root/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script qr is installed in '/root/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Electrum-4.0.2 aiohttp-3.6.2 aiohttp-socks-0.5.3 aiorpcx-0.18.4 async-timeout-3.0.1 attrs-20.1.0 bitstring-3.1.7 dnspython-1.16.0 helpdev-0.7.1 importlib-metadata-1.7.0 multidict-4.7.6 protobuf-3.13.0 pyaes-1.6.1 qdarkstyle-2.8.1 qrcode-6.1 qtpy-1.9.0 yarl-1.5.1 zipp-3.1.0
XXXXX@debian:~/Desktop$

__________________________

Root?

How do I edit bash or get an icon on my Desktop?  Any help would be appreciated.  This is on Debian Buster.


Edit:  this is a VM so I can easily start over (I kept a snapshot from before this install so its seconds to start over clean).  It seems to me that it would be much better to use PIP and go to user instead of root.



Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: jackg on September 03, 2020, 09:54:00 PM
You probably either ran sudo with pip, were already in sudo or somehow managed to install python in root.

Are you sure you gave a user and aren't just root? When you load up a console and pwd from the start, what do you see? /home/user?

I could give you some advanced technical solution for making a shortcut on the desktop, but I don't use it myself I just copy another shortcut and edit it with the right information. Just work out where lectrum. Installed and link the binary to that in the file (if debian still works the way it always did).



Type sudo python or sudo python3 and se if it works. If it does, you might want to reinstall debian or uninstall python from the superuser because I think that's a pretty major vulnerability afaik.


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 03, 2020, 10:06:39 PM
You probably either ran sudo with pip, were already in sudo or somehow managed to install python in root.

Are you sure you gave a user and aren't just root? When you load up a console and pwd from the start, what do you see? /home/user?

I could give you some advanced technical solution for making a shortcut on the desktop, but I don't use it myself I just copy another shortcut and edit it with the right information. Just work out where lectrum. Installed and link the binary to that in the file (if debian still works the way it always did).



Type sudo python or sudo python3 and se if it works. If it does, you might want to reinstall debian or uninstall python from the superuser because I think that's a pretty major vulnerability afaik.

Thanks for some ideas.  I like the idea of copying any old icon and then just changing the target.  That should save some time when I get to that point.

OMG  ----- > am I happy that I am learning in a VM with a clean snapshot.  I'll go back to the snap and install this again maybe later or tomorrow.  I will make sure I don't sudo unless Debian makes me.  Of course I am running in user and then sudo as needed.  I don't run root daily.


Assuming my install goes to user tomorrow, what would be your recommendations for path/Icon and how to handle that?  I am assuming I'll just redirect the icon to the path where PIP puts it in my user!

Edit again:  after thinking about this I bet I did sudo my PIP install of electrum.  I'll get back on this tomorrow or maybe later, if only life would get out of my way!

XXXX@debian:~$ sudo python3
[sudo] password for XXXX:
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: jackg on September 03, 2020, 10:11:05 PM




Assuming my install goes to user tomorrow, what would be your recommendations for path/Icon and how to handle that?  I am assuming I'll just redirect the icon to the path where PIP puts it in my user!

I think it should auto find the icon, if it doesn't you can probably find one in the folder or just download one - from the website so there's nothing hidden but I don't think mine hasn't found one - most have an img subfolder or similar or just place the icon in root.



Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 03, 2020, 10:17:18 PM




Assuming my install goes to user tomorrow, what would be your recommendations for path/Icon and how to handle that?  I am assuming I'll just redirect the icon to the path where PIP puts it in my user!

I think it should auto find the icon, if it doesn't you can probably find one in the folder or just download one - from the website so there's nothing hidden but I don't think mine hasn't found one - most have an img subfolder or similar or just place the icon in root.



Got it.

I'll do a fresh install from snapshot and make sure I don't get into root.  Stay tuned, LOL.    Tomorrow!!


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 03, 2020, 11:47:19 PM




Assuming my install goes to user tomorrow, what would be your recommendations for path/Icon and how to handle that?  I am assuming I'll just redirect the icon to the path where PIP puts it in my user!

I think it should auto find the icon, if it doesn't you can probably find one in the folder or just download one - from the website so there's nothing hidden but I don't think mine hasn't found one - most have an img subfolder or similar or just place the icon in root.



OK installed again from clean machine.  I did do sudo before Dumb A**!  NOW it is in /home/user/.local/bin/

I watched the install as before and it all went well.  When I open .local/bin I can click on and display the Electrum script so its there.  The bin folder only has a few small files all related to electrum.  The electrum file shows as executable of course, but it doesn't execute for me.

Do I need to add a PATH or how do I mount electrum on this install?  If I type electrum in the terminal it flashes for a second but nothing happens after that.

I am close here, just need the final piece!


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: jackg on September 04, 2020, 12:02:11 AM

OK installed again from clean machine.  I did do sudo before Dumb A**!  NOW it is in /home/user/.local/bin/

I watched the install as before and it all went well.  When I open .local/bin I can click on and display the Electrum script so its there.  The bin folder only has a few small files all related to electrum.  The electrum file shows as executable of course, but it doesn't execute for me.

Do I need to add a PATH or how do I mount electrum on this install?  If I type electrum in the terminal it flashes for a second but nothing happens after that.

I am close here, just need the final piece!

Have you tried  ./electrum all the guides I can see say it's just electrum you type in.

If that doesn't work "ls - l the folder and check it's - ##x##x### the # can be anything.

If it's isn't, run chmod 770 electrum


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 04, 2020, 12:06:02 AM
I'll give that a go.  Different computer may be a few minutes.


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 04, 2020, 12:39:06 AM
Still stuck.  I have about had it for the day.  Late late here.  This is my first electrum PIP install (I did the same version about a week ago but abandoned it and now I am back trying).  Its not electrum, its my newbie with PIP on linux issues.  I love Electrum, great product.

Still wondering if its a PATH issue or something simple.  I know this is an Electrum forum and not a linux tutor forum, but I really believe resolution of the issue will be able to help other users.  Its not child's play to deal with the .tar.gz option either.  Sure wish the guys would generate a .deb version since so many users are on ubuntu/debian/mint/etc.....  It would be really really nice!


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: jackg on September 04, 2020, 12:47:27 AM
My fleeting attempt would be this:
Code:
./run_electrum

https://github.com/spesmilo/electrum/blob/master/README.rst

It's at the very bottom, I thought it was just for running electrum normally.

I think the PATH stuff is just the environemntal variables/global variables thing so that you can call it from anywhere outside of root (but I'm not entirely sure as I like things to be separate too much).


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: bob123 on September 04, 2020, 12:51:44 PM
For future reference:

To make sure that the software you are installing, gets installed in your users directory (instead of the root directory) and to run pip without sudo, you need to use the --user parameter:

Code:
pip install --user PACKAGE

You should use sudo pip only if you want to install something system-wide (which should rarely be the case).


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: HCP on September 04, 2020, 11:13:58 PM
I just tried this from scratch on a "clean" Linux Mint install... following the (slightly modified) steps as per the Electrum download page (https://electrum.org/#download):

Install dependencies:
Code:
sudo apt-get install python3-pyqt5 libsecp256k1-0 python3-cryptography

Download package:
Code:
wget https://download.electrum.org/4.0.2/Electrum-4.0.2.tar.gz

Verify signature (Optional but HIGHLY recommended!):
Code:
wget https://download.electrum.org/4.0.2/Electrum-4.0.2.tar.gz.asc
wget https://raw.githubusercontent.com/spesmilo/electrum/master/pubkeys/ThomasV.asc
gpg --import ThomasV.asc
gpg --verify Electrum-4.0.2.tar.gz.asc

Install with PIP:
Code:
sudo apt-get install python3-setuptools python3-pip
python3 -m pip install --user Electrum-4.0.2.tar.gz

This ended up installing Electrum into ~/.local/bin

Because this was a "clean" install, this path (~/.local/bin) did NOT exist prior to logging in... so I had to logout and log back in as the code in default .profile to add "~/.local/bin" into the $PATH is only run at login... NOT when simply creating a new terminal.

Alternatively, you can use:
Code:
source .profile
and the $PATH should be updated.


Now, I can just use electrum from anywhere and it starts up:
https://www.talkimg.com/images/2023/11/15/z4plb.png


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 05, 2020, 11:13:46 PM
Quote
This ended up installing Electrum into ~/.local/bin

Because this was a "clean" install, this path (~/.local/bin) did NOT exist prior to logging in... so I had to logout and log back in as the code in default .profile to add "~/.local/bin" into the $PATH is only run at login... NOT when simply creating a new terminal.

Alternatively, you can use:
Code:

source .profile

and the $PATH should be updated.

HCP,

This is exactly where I am.  Perfect install into USER ~/.local/bin but now  ------- > specifically HOW to add the PATH?


Bob123,

Your idea for the user in the command line is also a nice "keep a user safe" option.  Thanks


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: HCP on September 06, 2020, 12:00:49 AM
This is exactly where I am.  Perfect install into USER ~/.local/bin but now  ------- > specifically HOW to add the PATH?
Is there anything in your .profile (or .bash_rc or .bash_profile) in your home dir? ???

The "default" .profile in my Linux Mint install had this code at the bottom:
Code:
...
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

If you have that... your PATH should automagically have ~/.local/bin whenever you open a new terminal.


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 06, 2020, 01:04:28 AM
This is exactly where I am.  Perfect install into USER ~/.local/bin but now  ------- > specifically HOW to add the PATH?
Is there anything in your .profile (or .bash_rc or .bash_profile) in your home dir? ???

The "default" .profile in my Linux Mint install had this code at the bottom:
Code:
...
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

If you have that... your PATH should automagically have ~/.local/bin whenever you open a new terminal.


Making some decent progress.  Looking at my original sudo gedit .profile I see this:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
   . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

____________________________
So I notice that the final piece of the puzzle is missing.  Therefore I added the section you noted above:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
________________

Now my sudo gedit .profile shows:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
   . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# my edit of sudo gedit .profile
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

________________

I now see the .electrum folder (with 51.8 meg of files) if I look in my home/user folder.  Remember the install went perfectly so its there!

Last piece is to figure out how to launch Electrum?  If I type electrum or .electrum in a terminal no go.  If I copy another icon how would I target electrum to mount it?  Even if I had to write an executable shell script to mount it I'ld be OK with it.  Seems like an Electrum icon is missing.  Target/mount ideas?


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: HCP on September 06, 2020, 02:40:19 AM
Last piece is to figure out how to launch Electrum?  If I type electrum or .electrum in a terminal no go.
Once you have modified the .profile... you either need to logout/login... or restart... or run the command:
Code:
source ~/.profile

as .profile is only parsed at login... not when you start up a terminal.

Once you've done one of those 3... you can use:
Code:
echo $PATH
to confirm that the change has worked... if you see the /home/USERNAME/.local/bin path shown... you should be able to just use electrum from the terminal and it will start.


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Coin-Keeper on September 06, 2020, 09:55:06 PM
Still no joy.  Not in path.  Multiple re-boots.  Paste:

XXXX@debian:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
XXXX@debian:~$

Strangely I can now see the .local folder and can click on it to see electrum and contents.  Hmmmmm?

Little frustrating, now I am being called away for a few days to put out some corporate brush fires.  It may be a few days/week until I can get back here and continue this.  Thanks for now!

My .profile was/is different from the one you posted.  I didn't see any bash stuff in your .profile.

Take care!



Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: HCP on September 07, 2020, 07:53:12 AM
Then you either edited the wrong .profile file... or it's not being used when you login...

If you:
Code:
source ~/.profile

Does the path then contain the "/home/XXXX/.local/bin" path? ???

Also, try:
Code:
cat ~/.profile

And make sure it shows the following code in the output
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi


Title: Re: I need Sherlock Holmes to help me find the PIP installed Electrum, LOL!
Post by: Abdussamad on September 07, 2020, 01:42:04 PM
add this to your ~/.bashrc file:

Code:
export PATH="$PATH:$HOME/.local/bin"


alternatively just create a shortcut to ~/.local/bin/run_electrum on your desktop or menu or whatever.