Cannot install Youtube-dl

I have just installed linuxmint 20, and am having problems installing Youtube-dl. I’ve tried from the package manager, and also the command line via the terminal. All I get is:- /usr/bin/env: ‘python’: No such file or directory, at every attempt. Also Amavis will not install. Any help would be much appreciated.

Thank you

Interesting… I have a fresh Linux Mint 20 Cinnamon install. I used apt command to install it and encountered no error in installing youtube-dl.

1 Like

Still get Sub-process /usr/bin/dpkg returned an error code (1) even using apt install

it may be helpful to post your terminal input and output to see what command is being given and what the error says in relation to the whole instead of just as a single line.

1 Like
apt update
apt policy python3
apt install -y --reinstall python3
apt policy python3

Post the output of the commands here.

1 Like
sudo apt install youtube-dl
[sudo] password for ken:        
Reading package lists... Done
Building dependency tree       
Reading state information... Done
youtube-dl is already the newest version (2020.03.24-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up amavisd-new (1:2.11.0-6.1ubuntu1) ...
Creating/updating amavis user account...
Job for amavis.service failed because the control process exited with error code.
See "systemctl status amavis.service" and "journalctl -xe" for details.
invoke-rc.d: initscript amavis, action "start" failed.
● amavis.service - LSB: Starts amavisd-new mailfilter
     Loaded: loaded (/etc/init.d/amavis; generated)
     Active: failed (Result: exit-code) since Wed 2020-07-08 11:38:31 WEST; 7ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 14206 ExecStart=/etc/init.d/amavis start (code=exit
ed, status=1/FAILURE)

Jul 08 11:38:31 ken-Inspiron-3581 amavis[14238]: ead: cannot ope
n '/etc/mailname' for reading: No such
Jul 08 11:38:31 ken-Inspiron-3581 amavis[14233]: ead: cannot ope
n '/etc/mailname' for reading: No such
Jul 08 11:38:31 ken-Inspiron-3581 amavis[14233]:  The value of v
ariable $myhostname is "ken-Inspiron-3581", but should have been
Jul 08 11:38:31 ken-Inspiron-3581 amavis[14233]:   a fully quali
fied domain name; perhaps uname(3) did not provide such.
Jul 08 11:38:31 ken-Inspiron-3581 amavis[14233]:   You must expl
icitly assign a FQDN of this host to variable $myhostname
Jul 08 11:38:31 ken-Inspiron-3581 amavis[14233]:   in /etc/amavi
s/conf.d/05-node_id, or fi
Jul 08 11:38:31 ken-Inspiron-3581 amavis[14206]:   in /etc/
Jul 08 11:38:31 ken-Inspiron-3581 systemd[1]: amavis.service: Co
ntrol process exited, code=exited, status=1/FAILURE
Jul 08 11:38:31 ken-Inspiron-3581 systemd[1]: amavis.service: Fa
iled with result 'exit-code'.
Jul 08 11:38:31 ken-Inspiron-3581 systemd[1]: Failed to start LS
B: Starts amavisd-new mailfilter.
dpkg: error processing package amavisd-new (--configure):
 installed amavisd-new package post-installation script subproce
ss returned error exit status 1
Errors were encountered while processing:
 amavisd-new
E: Sub-process /usr/bin/dpkg returned an error code (1)
ken@ken-Inspiron-3581:~$
apt install -y --reinstall python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 47,6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3 amd64 3.8.2-0ubuntu2 [47,6 kB]
Fetched 47,6 kB in 0s (138 kB/s)  
(Reading database ... 357681 files and directories currently ins
talled.)
Preparing to unpack .../python3_3.8.2-0ubuntu2_amd64.deb ...
running python pre-rtupdate hooks for python3.8...
Unpacking python3 (3.8.2-0ubuntu2) over (3.8.2-0ubuntu2) ...
Setting up python3 (3.8.2-0ubuntu2) ...
running python rtupdate hooks for python3.8...
running python post-rtupdate hooks for python3.8...
Setting up amavisd-new (1:2.11.0-6.1ubuntu1) ...
Creating/updating amavis user account...
Job for amavis.service failed because the control process exited
 with error code.
See "systemctl status amavis.service" and "journalctl -xe" for d
etails.
invoke-rc.d: initscript amavis, action "start" failed.
● amavis.service - LSB: Starts amavisd-new mailfilter
     Loaded: loaded (/etc/init.d/amavis; generated)
     Active: failed (Result: exit-code) since Wed 2020-07-08 11:
41:14 WEST; 7ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 15306 ExecStart=/etc/init.d/amavis start (code=exit
ed, status=1/FAILURE)

Jul 08 11:41:14 ken-Inspiron-3581 amavis[15343]: ead: cannot ope
n '/etc/mailname' for reading: No such
Jul 08 11:41:14 ken-Inspiron-3581 amavis[15320]: ead: cannot ope
n '/etc/mailname' for reading: No such
Jul 08 11:41:14 ken-Inspiron-3581 amavis[15320]:  The value of v
ariable $myhostname is "ken-Inspiron-3581", but should have been
Jul 08 11:41:14 ken-Inspiron-3581 amavis[15320]:   a fully quali
fied domain name; perhaps uname(3) did not provide such.
Jul 08 11:41:14 ken-Inspiron-3581 amavis[15320]:   You must expl
icitly assign a FQDN of this host to variable $myhostname
Jul 08 11:41:14 ken-Inspiron-3581 amavis[15320]:   in /etc/amavi
s/conf.d/05-node_id, or fi
Jul 08 11:41:14 ken-Inspiron-3581 amavis[15306]:   in /etc/
Jul 08 11:41:14 ken-Inspiron-3581 systemd[1]: amavis.service: Co
ntrol process exited, code=exited, status=1/FAILURE
Jul 08 11:41:14 ken-Inspiron-3581 systemd[1]: amavis.service: Fa
iled with result 'exit-code'.
Jul 08 11:41:14 ken-Inspiron-3581 systemd[1]: Failed to start LS
B: Starts amavisd-new mailfilter.
dpkg: error processing package amavisd-new (--configure):
 installed amavisd-new package post-installation script subproce
ss returned error exit status 1
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 amavisd-new
E: Sub-process /usr/bin/dpkg returned an error code (1)
ken@ken-Inspiron-3581:~$ apt policy python3
python3:
  Installed: 3.8.2-0ubuntu2
  Candidate: 3.8.2-0ubuntu2
  Version table:
 *** 3.8.2-0ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
ken@ken-Inspiron-3581:~$

Post the output of these commands here.

2 Likes

that says youtube-dl is already installed.

1 Like

Yes, Youtube-dl is installed, but it will not respond. Here is the output I get when trying go download a Youtube-dl video:-
youtube-dl “https://youtu.be/EAy01UQ_iJE
/usr/bin/env: ‘python’: No such file or directory

if you run whereis python it will tell you where the bin file for python is located. mine is in /usr/bin. yours may be different. please check first.

you can then run ls -l /usr/bin | grep python (but make sure to change /usr/bin if yours are in a different directory) to see what python links to. on my system it looks like this:

$ ls -l /usr/bin | grep python
-rwxr-xr-x 1 root root 1056 Apr 16 2018 dh_python2
lrwxrwxrwx 1 root root 23 Apr 15 12:20 pdb2.7 -> …/lib/python2.7/pdb.py
lrwxrwxrwx 1 root root 23 Apr 17 20:56 pdb3.6 -> …/lib/python3.6/pdb.py
lrwxrwxrwx 1 root root 31 Feb 9 22:04 py3versions -> …/share/python3/py3versions.py
lrwxrwxrwx 1 root root 9 Feb 9 22:04 python -> python2.7

you can see the last entry showing python is a symlink to python2.7. if yours is similar, that might be the problem since youtube-dl depends on python3.

1 Like

To extend @01101111’s search, you can use the following, just to be thorough:

#!/bin/bash

python_files=( $(sudo find / -name "python*" 2>/dev/null) )

for file in ${python_files[@]}; do
  if [[ -x "${file}" ]]; then
    echo "Executable found: ${file}"
  fi
done
1 Like

In my experience, Google is getting really pissed by anyone using a different browser that prevents them collecting ‘all’ your information.
Often, downloads from official sources just don’t work unless you use Chrome. (particularly if you have to use App Store)
The only way I’ve found is to have something which cannot use Chrome and gets an error message - Chrome is not supported by your CPU, OS or similar- (since it’s multiple updates it seems very CPU intensive, maybe it’s just all the installed trackers and PUPS?)
This ‘shouldn’t’ be the problem but may be worth investigating?
(or maybe I’m being paranoid for no reason?)

This is the output I get from whereis python:

whereis python
python: /usr/bin/python3.8 /usr/bin/python2.7 /usr/lib/python3.8 /usr/lib/python2.7 /etc/python3.8 /etc/python2.7 /usr/local/bin/python3.7m /usr/local/bin/python3.7m-config /usr/local/bin/python3.7 /usr/local/lib/python3.8 /usr/local/lib/python2.7 /usr/local/lib/python3.7 /usr/include/python3.8m /usr/include/python3.8 /usr/share/python /usr/src/Python-3.7.8/python
ken@ken-Inspiron-3581:~$ ls -l /usr/bin | grep python
lrwxrwxrwx 1 root root          56 Jul  4 09:35 apt-changelog -> ../lib/python3/dist-packages/mintcommon/apt_changelog.py
-rwxr-xr-x 1 root root        1057 Mar 13 12:31 dh_python2
lrwxrwxrwx 1 root root          23 Jul  4 09:35 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root root          23 Apr 27 16:53 pdb3.8 -> ../lib/python3.8/pdb.py
lrwxrwxrwx 1 root root          31 Jul  4 09:35 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root           9 Jul  4 09:35 python2 -> python2.7
-rwxr-xr-x 1 root root     3694632 Apr  7 13:05 python2.7
lrwxrwxrwx 1 root root           9 Jul  4 09:35 python3 -> python3.8
-rwxr-xr-x 1 root root     5457536 Apr 27 16:53 python3.8
lrwxrwxrwx 1 root root          29 Jul  4 09:35 pyversions -> ../share/python/pyversions.py
ken@ken-Inspiron-3581:~$

Try this:

which python
sudo update-alternatives --set python /usr/bin/python3
which python
3 Likes

I am still getting the following output, when trying to download Youtube fies:-
/usr/bin/env: ‘python’: No such file or directory

Somebody please help It is exasperating.

Thanks

I don’t use mint - but surely Ubuntu 20.04 can’t be that different?

For me, youtube-dl is part of my “SOE” I use across all my Linux boxes - I think this is how I get it working these days (i.e. “pip3” instead of “pip”) :

sudo apt install python3-pip

then probably :

pip3 install youtube-dl

3 Likes

Thanks for the tip, which I’ve obviously tried. However still get an output of /usr/bin/env: ‘python’: No such file or directory when I try and downland a youtube video.

did you try these commands?

2 Likes

Hello Goodmans, I use Clipgrab as my YouTube downloader, plus it can download from Facebook too as well as a whole host of others.
These instructions will give you the latest version and as it is a App-Image it will be set as a launcher inside Menu/Internet.
Follow the instructions below and change mark to your username.

Open a terminal and run these commands in sequence…

Create a directory for the ClipGrab AppImage:

mkdir -p ~/.AppImages/ClipGrab

make it the current directory:

cd ~/.AppImages/ClipGrab

download the ClipGrab appimage into it:

wget -O ClipGrab-Latest.AppImage https://download.clipgrab.org/ClipGrab-3.8.13-x86_64.AppImage

make the ClipGrab-Latest.AppImage executable:

chmod +x ~/.AppImages/ClipGrab/ClipGrab-Latest.AppImage

download an image to use as an icon:

wget http://icons.iconarchive.com/icons/papirus-team/papirus-apps/256/clipgrab-icon.png

create a launcher for it by creating a folder in .local called applications, then running:

mkdir -p ~/.local/share/applications
xed ~/.local/share/applications/clipgrab.desktop

and when a blank file opens, make it read:-

[Desktop Entry]
Type=Application
Name=ClipGrab
Comment=Download YouTube, Dailymotion, etc. Video Clips
Exec=/home/mark/.AppImages/ClipGrab/ClipGrab-Latest.AppImage
Icon=/home/mark/.AppImages/ClipGrab/clipgrab-icon.png
Terminal=false
StartupWMClass=ClipGrab
Categories=Network;
StartupNotify=false

(be sure to change the 2 instances of ‘mark’ to your username)

SAVE the file.
Then logout or reboot for changes to take effect. You should see ClipGrab inside Menu/Internet.

1 Like