need <unrar/dll.hpp> to pip install unrardll on Ubuntu

4

1

After upgrading to Ubuntu 18.04, Calibre gives this error when opening a .cbr file:

calibre, version 3.21.0
...
    File "/usr/lib/calibre/calibre/utils/unrar.py", line 53, in extract
       from unrardll import extract
ImportError: No module named unrardll

Okay, so...

#> sudo pip install unrardll

...

src/unrardll/wrapper.cpp:19:10: fatal error: unrar/dll.hpp: No such file or directory
#include <unrar/dll.hpp>
      ^~~~~~~~~~~~~~~
compilation terminated

Hmm...

#> dpkg -S unrar/dll.hpp
dpkg-query: no path found matching pattern *unrar/dll.hpp*

How do I install the unrardll Python module on Ubuntu 18.04?

spraff

Posted 2018-06-26T08:46:45.820

Reputation: 1 238

can you accept the answer provided? – Routhinator – 2018-10-11T00:05:37.817

Answers

3

The unrar sources, development files and library aren't packaged for Ubuntu, so you'll need to get them and install them yourself...

There is an "UnRAR source" download on the "extras" page of rarlab.com - use this link with wget below.

You'll need to build and install the library, and then use the --global-option with pip to point it at the headers.

Follow along below:

apt update
apt install -y build-essential python-pip wget
mkdir unrarsrc
cd unrarsrc
wget https://rarlab.com/rar/unrarsrc-5.6.8.tar.gz
tar -xvf unrarsrc-5.6.8.tar.gz
make -C unrar lib
sudo make -C unrar install-lib
sudo pip install --global-option=build_ext --global-option="-I$(pwd)" unrardll
$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import unrardll
>>>

Please note that after doing this, the UnRAR library will be under your control, and thus you will be responsible for updating it. The unrar utility will still be provided by the package manager, so will update as normal.


There is a PPA that provides the packages required for this, but the most recent version of Ubuntu supported is "Saucy Salamander" (13.10), last updated ~5 years ago with unrar v5.0.14.

https://launchpad.net/~trinitronx/+archive/ubuntu/unrar-nonfree

Attie

Posted 2018-06-26T08:46:45.820

Reputation: 14 841

1Great, one change needed for bounty however. The wget needs to be done after the cd unrarsrc-5.6.8 in order for your tar -xvf unrarsrc-5.6.8 to be successful. Also a sudo in front of make -C unrar install-lib – Routhinator – 2018-10-07T13:44:38.677

1done - I usually prefer to avoid providing sudo, but I've added it anyway. – Attie – 2018-10-07T13:59:34.000

Fair enough, however most in the Ubuntu desktop realm that will be using this will be in the context of a non-priviledged user. – Routhinator – 2018-10-07T14:34:29.403

1I know - I like people to think about privilege and use of sudo for themselves ;-) – Attie – 2018-10-07T14:41:13.463

1Now that the required time has passed, bounty awarded. Thanks. – Routhinator – 2018-10-08T17:07:25.057

-1

first do make lib make install-lib then, try pip install unrar

Holy Llama

Posted 2018-06-26T08:46:45.820

Reputation: 3