15

I am using Ubuntu 16.04, running this command succeeded:

sudo snap install spotify

And running it again indicates Spotify is installed. However, running:

spotify

Gives command not found! Searching in Unity for "spotify" yields no results. What can I do?

galoget
  • 2,963

7 Answers7

27

Check your $PATH variable by executing in a Terminal:

echo $PATH

The output should be very similar to this:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin

You have to verify if /snap/bin is included in this $PATH, otherwise you have to add it manually, here is how to do it: How do I modify my PATH so that the changes are available in every Terminal session.

If this doesn't work, try deleting and installing again the snap, the required commands are:

  • Execute sudo snap list to verify if Spotify is installed.

  • Use sudo snap remove spotify to delete it.

  • Use sudo snap install spotify to re-install it again.

After installing it you can run the command which spotify to see if it is recognized now.

Hope it helps, good luck!

galoget
  • 2,963
8

The solution is simple. Log out and log back in again.

Same thing happened to me. It was the first time I had installed a snap app, and I expect that the $PATH variable had changed as per other answers, but the change only takes effect after logging out and logging back in again.

galoget
  • 2,963
Paul Phillips
  • 171
  • 4
  • 12
4

Personally, I simply had to open a different Terminal window. For some reason it couldn't find it from the window I'd used to run the snap command.

karuhanga
  • 141
  • 3
    source ~/.profile should have the same effect if you don't want to open a new terminal. – Bprodz Aug 13 '18 at 11:33
  • @Bprodz , yours is the right answer. Please consider posting it as an answer so I can upvote it. Let me know when you do. – evaristegd Apr 20 '20 at 01:57
0

Another solution is go to the folder /snap/spotify/6/usr/bin/ and double-click the file spotify.

This worked to me.

AlwaysTalkingAboutMyDog
  • 3,783
  • 2
  • 25
  • 38
0

I've added to the menu using alacarte, then adding /snap/bin/spotify to the music section

Eduardo
  • 101
  • 2
0

I'm on elementary OS FWIW. My paths are correct.

I was able to manually launch the item via @Zzzach...'s answer subbing in the symlink "current" for the version number as his answer must have been early on in the snap spotify install.

So I manually edited the desktop entry at:

/var/lib/snapd/desktop/applications/spotify_spotify.desktop 

To change the exec location from:

/snap/spotify

To:

/snap/spotify/current/usr/bin/spotify %U

and then it worked via snap. Whether it persists across an update is another story.

I think you could also edit this via the alacarte option too.

galoget
  • 2,963
0

On debian 9, I had to add /snap/bin to the root PATH manually. Do the following:

In /etc/login.defs, you will find the following line:

ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Add the path so that it will be:

ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Exit the session, and login again.

  • This post is related : https://askubuntu.com/questions/1434765/cannot-locate-base-snap-core20-no-such-file-or-directory/1441064#1441064 –  Nov 16 '22 at 15:09