1

I installed libarchive on my Ubuntu box using apt install libarchive-dev and then used pip to install libarchive for Python pip3 install libarchive.

My issue now is that the installation seems be incorrect as libarchive does not provide any function at all as indicated by the following output:

$ python3
Python 3.7.3 (default, Aug 20 2019, 17:04:43) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libarchive
>>> dir(libarchive)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__']

and the library itself

$ ll /usr/lib/x86_64-linux-gnu/libarchive.*
-rw-r--r-- 1 root root 1.4M Feb  6  2019 /usr/lib/x86_64-linux-gnu/libarchive.a
lrwxrwxrwx 1 root root   20 Feb  6  2019 /usr/lib/x86_64-linux-gnu/libarchive.so -> libarchive.so.13.3.3
lrwxrwxrwx 1 root root   20 Feb  6  2019 /usr/lib/x86_64-linux-gnu/libarchive.so.13 -> libarchive.so.13.3.3
-rw-r--r-- 1 root root 722K Feb  6  2019 /usr/lib/x86_64-linux-gnu/libarchive.so.13.3.3

I tried this both on Ubuntu 19.04 and 18.04 and got the same result each time. I figure I must be missing something obvious but I can't find it for the life of me.

Thanks in advance for your help.

Azrael3000
  • 1,847
  • 12
  • 23
  • 1
    All of the libarchive examples I see use something like `import libarchive.public` - apparently the top-level module doesn't contain anything but submodules. – jasonharper Sep 19 '19 at 16:40
  • @jasonharper thanks for that. This is indeed the solution. The legacy code I had did not use this, hence I never tried that. If you want to post your reply as answer I'd gladly mark it as solution. Cheers – Azrael3000 Sep 19 '19 at 21:39
  • There's a reason for the confusion, as there are 2 different versions of libarchive for python, the one I used which can be installed with pip as libarchive and the other as libarchive-c – Azrael3000 Sep 27 '19 at 08:32

0 Answers0