data-science-experience

How to extract 7zip file from IBM Data Science Experience Notebook


Silly question, but being unable to install 7zip from the notebook, and not having access to the underling system, I am here stuck with different 7zip archives obtained via wget which I am not able to extract.

Also I would like to avoid the obvious option of downloading archives locally, and eventually upload data unzipped or in different formats, not really a process I can automatize easily.


Solution

  • Not tested, but an idea: DSX allows to install custom libraries. You could try to install py7zlib which is able to decompress 7zip archives:

    !pip install --user py7zlib
    

    An later something like

    myfile=open(filename,"rb")
    archive = py7zlib.Archive7z(myfile)
    data = archive.getmember(archive.getnames()[0]).read()