Satisfying dependencies for installation of HPLIP

Shmu26

Member
Joined
Dec 11, 2018
Messages
95
Reaction score
32
Credits
624
I downloaded the HPLIP installation file "hplip-3.20.6.run" for Ubuntu from the official HP site and attempted to run it on Kubuntu 20.04.
It was unable to satisfy a python dependency.
I saw a post from Christian Haunert
with a solution to the problem, although it was for a different version of Kubuntu. He says, "You just need to update "the symbolic link" of python inside /usr/bin/"
and gives instructions:

Code:
root@xxxxx:/usr/bin# ls -lrth python*
lrwxrwxrwx 1 root root    9 Apr 16  2018 python -> python2.7
-rwxr-xr-x 1 root root 3.6M Nov 12  2018 python2.7
-rwxr-xr-x 2 root root 4.4M May  7 14:58 python3.6

In above example if you see the output of python --version you will get python2.7 Now update the python symlink using below command-

Code:
root@irshad:/usr/bin# unlink python
root@irshad:/usr/bin# ln -s /usr/bin/python3.6 python
root@irshad:/usr/bin# python --version
Python 3.6.8


This was his fix. It worked for me and I was subsequently able to install HPLIP without a hitch.
Does someone understand what exactly this code does, and is it safe to run it on my system?
 


listing which pythons are installed and seeing there is a link from the generic 'python' to python2.7

Wants to link not 2.7 but 3.6

unlinking python from version 2.7
making a symbolic link from python3.6 to python
checking to make sure the link is going where wanted (python 3.6)

You will have to list for your specific machine as his specific may not be yours
then follow his example for the commands only

See Linux Man pages at die.net and just type in as instructed or search by table of contents
 
What that does is makes python 3 your systems default python version.

Switching to use python3 will allow that installer to succeed, but your systems default python version is v2 - so switching to v3 could cause problems elsewhere in your system.

for example, there are some changes in python 3 that are not backwards compatible with python 2, so after making this change - system scripts written in python2 might fail with syntax errors when the system tries to execute them with python 3.

Also, certain python2 scripts used by your system might use python libraries/ site packages that aren’t installed by default in your python 3 installation. So when ran with python 3, python 2 system scripts might fail with error messages regarding missing libraries. In which case, you’d need to ensure that for each site package you have in python 2 has an equivalent package installed in python 3.

Personally, I’d keep python 2 as your default python until your chosen distro makes the switch to python 3.

What output does the following command yield?
Bash:
file hplip-3.20.6.run

If it says that the .run file is a python script, then simply run it using:
Bash:
python3.6 hplip-3.20.6.run

That way, the installer should run directly under python 3, without needing to change your systems default python version.
 
What that does is makes python 3 your systems default python version.

Switching to use python3 will allow that installer to succeed, but your systems default python version is v2 - so switching to v3 could cause problems elsewhere in your system.

for example, there are some changes in python 3 that are not backwards compatible with python 2, so after making this change - system scripts written in python2 might fail with syntax errors when the system tries to execute them with python 3.

Also, certain python2 scripts used by your system might use python libraries/ site packages that aren’t installed by default in your python 3 installation. So when ran with python 3, python 2 system scripts might fail with error messages regarding missing libraries. In which case, you’d need to ensure that for each site package you have in python 2 has an equivalent package installed in python 3.

Personally, I’d keep python 2 as your default python until your chosen distro makes the switch to python 3.

What output does the following command yield?
Bash:
file hplip-3.20.6.run

If it says that the .run file is a python script, then simply run it using:
Bash:
python3.6 hplip-3.20.6.run

That way, the installer should run directly under python 3, without needing to change your systems default python version.
Code:
file hplip-3.20.6.run

hplip-3.20.6.run: POSIX shell script executable (binary data)

Thanks for the explanation and the caveat. Now I understand better what I did. It's been a few days already, and I haven't seen any error messages or strange behavior, but that doesn't mean it won't happen later on.
 
It looks like python 3.8 is actually the default version for new installs of Ubuntu 20.04, but upgraded systems (like mine) maintain version 2, for compatibility with legacy scripts. So I should be okay.

"Python3 by default

In 20.04 LTS, the python included in the base system is Python 3.8. Python 2.7 has been moved to universe and is not included by default in any new installs.

Remaining packages in Ubuntu which require Python 2.7 have been updated to use /usr/bin/python2 as their interpreter, and /usr/bin/python is not present by default on any new installs. On systems upgraded from previous releases, /usr/bin/python will continue to point to python2 for compatibility. Users who require /usr/bin/python for compatibility on newly-installed systems are encouraged to install the python-is-python3 package, for a /usr/bin/python pointing to python3 instead.

Due to this transition the legacy python and python-minimal packages might be removed during an upgrade, being replaced by the python2 and python2-minimal packages as dependencies of the python-is-python2 package."
 
In 20.04 LTS, the python included in the base system is Python 3.8. Python 2.7 has been moved to universe and is not included by default in any new installs.

Same with fedora32. You can still install python 2.x if you need to, but python3.8 is the default now.
python2.x is not installed by default.
 
Anyone know what will happen if I try to install the HP version of HPLIP (as opposed to the distro-provided version) on MX Linux 19? HP doesn't offer an MX-specific installer, but they do have one for Debian (which MX is based on).
 
In either case, after the install run hp-check in a terminal. hp-check runs in the terminal and at the end lists packages that need to be installed. Go through that list, manually install each with your package manager (apt or whatever), and when you are done run hp-check again. It takes a few minutes, but you will end up with a correctly running HPLIP. Chances are the distro version will run slightly better than the HP site provided version, but the difference is minor.

Do not mess with your Python install, Linux uses both and it is set up the way it is for a reason.
 

Members online


Top