tar: Error opening archive: Can't initialize filter; unable to run program "bzip2 -d"

Viewed 5939

I'm trying to run this code from : https://github.com/pnnl/safekit ,using cmd on windows 10, I already installed python. when I type the command:

tar -xjvf data_examples.tar.bz2

I keep getting the error:

tar: Error opening archive: Can't initialize filter; unable to run program "bzip2 -d"

I have tried to download bzip2 through easy-7 zip and GnuWin32 , but it didn't work. Can any one help me?

P.S.: I did search for the same problem before posting mine.

2 Answers

I've run into the same problem! My non-elegant solution so far has been to force Windows's tar.exe to use the bzip2.exe provided with my Windows Git installation. The trick is to add to your user PATH the directory where bzip2.exe is located, in my case:

C:\Program Files\Git\mingw64\bin

So, right now my PATH looks like:

Path=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Git\mingw64\bin

Notice that I've only touched the user environment PATH, not the system PATH, and I've appended the new directory. As always, touching your PATH can be a little bit dangerous, proceed with care. If someone has a better solution, I'd be glad to hear it.

Note: I tried copying the bzip2.exe to a separate directory, but this didn't work (I presume because bzip2.exe couldn't find some dependencies).

If you run the command in git bash instead of cmd it should work.

Related