{"id":34203,"date":"2021-07-20T14:39:19","date_gmt":"2021-07-20T14:39:19","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=34203"},"modified":"2024-04-26T13:51:01","modified_gmt":"2024-04-26T13:51:01","slug":"install-latest-hplip-ubuntu-20-04-fix","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2021\/07\/install-latest-hplip-ubuntu-20-04-fix\/","title":{"rendered":"How to Install the Latest HPLIP Driver in Ubuntu 20.04 [Fix Dependency Issue]"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hp-icon250.png\" alt=\"\" width=\"250\" height=\"250\" class=\"alignleft size-full wp-image-34204\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hp-icon250.png 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hp-icon250-150x150.png 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/p>\n<p>Need the most recent HPLIP to get your HP printer or scanner working in Ubuntu? Here&#8217;s how to install guide as well as workaround to fix the <b><i>python-pyqt5<\/i><\/b> dependency issue.<\/p>\n<p>HPLIP is an open-source Linux drivers for HP&#8217;s inkjet and laser printers. The project is initiated and led by HP Inc. While the package in Ubuntu repositories is always old, you can install the official binary to get new devices support.<\/p>\n<p>However, the most recent releases refuse to install in my Ubuntu 20.04 due to <i>python-pyqt5<\/i> dependency issue. If you&#8217;re facing with the similar issue, then this tutorial may help!<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip3216.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip3216-600x360.jpg\" alt=\"\" width=\"600\" height=\"360\" class=\"aligncenter size-large wp-image-34205\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip3216-600x360.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip3216-300x180.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip3216-768x461.jpg 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip3216.jpg 1100w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>Download &#038; Install HPLIP in Ubuntu 20.04<\/h3>\n<p><b>1.)<\/b> Firstly, download the latest binary from the link below. It&#8217;s &#8216;<i>hplip-3.21.10.run<\/i>&#8216; at the moment.<\/p>\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link has-vivid-cyan-blue-to-vivid-purple-gradient-background has-text-color has-background\" href=\"https:\/\/sourceforge.net\/projects\/hplip\/files\/hplip\/\" target=\"_blank\" rel=\"noreferrer noopener\">Download HPLIP (.run)<\/a><\/div>\n<\/div>\n<p><b>2.)<\/b> Next, add executable permission by pressing <b>Ctrl+Alt+T<\/b> on keyboard to open terminal. Then run command:<\/p>\n<pre>chmod u+x ~\/Downloads\/hplip*.run<\/pre>\n<p>And try to install it via command: <\/p>\n<pre>~\/Downloads\/hplip*.run<\/pre>\n<p>Follow the terminal output and answer some questions to start installing the driver.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/install-hpliprun.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/install-hpliprun.png\" alt=\"\" width=\"595\" height=\"216\" class=\"aligncenter size-full wp-image-34206\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/install-hpliprun.png 595w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/install-hpliprun-300x109.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/a><\/p>\n<h4>3.) Fix python-pyqt5 dependency issue.<\/h4>\n<p>As I said, it refuse to install in Ubuntu 20.04 because it tries to install old Python 2 binding for Qt5 as dependency in my case. <\/p>\n<p>Thanks to <i>Christoph Mueller<\/i>, I found it has something to do with <b>python<\/b> symbolic links.<\/p>\n<p>As you may know, <code>python2<\/code> and <code>python3<\/code> in \/usr\/bin are symbolic links. While python2 is python2.7, python3 links to python3.8 (or 3.9 depends on Ubuntu edition), <code>python<\/code> is not exist out-of-the-box. However, it will be created in some cases and links to either python2 or python3.<\/p>\n<p>And the point is <b>when Python links to Python2, HPLIP will mistakenly try to install Python 2 libraries as dependency<\/b>.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/ll-python.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/ll-python.png\" alt=\"\" width=\"600\" height=\"219\" class=\"aligncenter size-full wp-image-34207\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/ll-python.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/ll-python-300x110.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>Until HPLIP fixed the issue, the solution is either remove <code>\/usr\/bin\/python<\/code> if you don&#8217;t need it or make it link to Python3.<\/p>\n<h4>Make Python to be Python3:<\/h4>\n<p>There are two choices to create symlink for python: install python-is-python3 or use update-alternatives command.<\/p>\n<p><b>Option 1.<\/b> Open terminal and run command to install &#8216;python-is-python3&#8217;:<\/p>\n<pre>sudo apt install python-is-python3<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/python-python3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/python-python3.png\" alt=\"\" width=\"600\" height=\"217\" class=\"aligncenter size-full wp-image-34208\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/python-python3.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/python-python3-300x109.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><b>Option 2.<\/b> Use &#8216;update-alternatives&#8217; to choose which to link to. Firstly, add both python2 and python3 as alternatives:<\/p>\n<pre>sudo update-alternatives --install \/usr\/bin\/python python \/usr\/bin\/python2 1<\/pre>\n<pre>sudo update-alternatives --install \/usr\/bin\/python python \/usr\/bin\/python3 2<\/pre>\n<p>You can then choose which to use anytime via command:<\/p>\n<pre>sudo update-alternatives --config python<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/update-alternatives-python.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/update-alternatives-python.png\" alt=\"\" width=\"600\" height=\"282\" class=\"aligncenter size-full wp-image-34209\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/update-alternatives-python.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/update-alternatives-python-300x141.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>Finally, re-do <i>step 2.)<\/i> to install the HPLIP-*.run file.<\/p>\n<p><b>4.) Fix make command failed issue:<\/b><\/p>\n<p>This seems to be HPLIP 3.21.6 only issue, that it outputs &#8216;<i>error: make command failed with status code 2<\/i>&#8216;.<\/p>\n<p>By re-running &#8216;make&#8217; command from the source folder (<i>see Uninstall section<\/i>), it tells that &#8220;\/usr\/bin\/ld: cannot find -lavahi-core&#8221;. <\/p>\n<p>And it can be fixed by installing libavahi-core-dev package via command:<\/p>\n<pre>sudo apt install libavahi-core-dev<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/apt-libavahi-core-dev.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/apt-libavahi-core-dev.png\" alt=\"\" width=\"600\" height=\"168\" class=\"aligncenter size-full wp-image-34210\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/apt-libavahi-core-dev.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/apt-libavahi-core-dev-300x84.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>How to Remove HPLIP from Ubuntu:<\/h3>\n<p>While installing HPLIP via <i>step 2.)<\/i>, it extracts the .run package into the source folder. And you can find it in Downloads folder.<\/p>\n<p><b>NOTE: HPLIP 3.21.10 somehow does not create source folder. Run <code>~\/Downloads\/hplip*.run --target ~\/Downloads\/hplip<\/code> to generate it manually if required.<\/b><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip-folder.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip-folder-600x335.jpg\" alt=\"\" width=\"600\" height=\"335\" class=\"aligncenter size-large wp-image-34211\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip-folder-600x335.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip-folder-300x168.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/hplip-folder.jpg 766w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>The folder contains an uninstall script allows to remove HPLIP from your computer.<\/p>\n<p>To do so, go to the source folder, right-click on blank area and select &#8216;Open in Terminal&#8217;.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/open-hplip-terminal.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/open-hplip-terminal-600x338.jpg\" alt=\"\" width=\"600\" height=\"338\" class=\"aligncenter size-large wp-image-34212\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/open-hplip-terminal-600x338.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/open-hplip-terminal-300x169.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/open-hplip-terminal.jpg 763w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>Finally, run the uninstall script in pop-up terminal window:<\/p>\n<pre>sudo python3 uninstall.py<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/uninstall-hplip.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/uninstall-hplip.png\" alt=\"\" width=\"600\" height=\"288\" class=\"aligncenter size-full wp-image-34213\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/uninstall-hplip.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/07\/uninstall-hplip-300x144.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>That&#8217;s all. <\/p>","protected":false},"excerpt":{"rendered":"<p>Need the most recent HPLIP to get your HP printer or scanner working in Ubuntu? Here&#8217;s how to install guide as well as workaround to fix the python-pyqt5 dependency issue. HPLIP is an open-source Linux drivers for HP&#8217;s inkjet and laser printers. The project is initiated and led by HP Inc. While the package in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":33735,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1382],"class_list":["post-34203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-hplip"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/34203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=34203"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/34203\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/33735"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=34203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=34203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=34203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}