For my project, I want to install Python 3.6 on my Ubuntu machine that was not available in the Ubuntu Official Repository. So, I have decided to follow my own guide Building Programs from Source on any Linux Distribution in a simple way to Install Python from Gzipped source tarball.
I was able to run,
make without any error. When I pass the final command,
sudo make install, it shows “zipimport.ZipImportError: can’t decompress data; zlib not available.”
This issue mostly occurs when zlib is not installed in your system. We can easily fix this issue with the required dependencies. Therefore we will Install zlib libraries for Ubuntu, Debian and Centos, Fedora, Redhat.
- Terminal with sudo privileges
- Build essentials or development tools preinstall
Install Missing zlib1-g dev dependencies
What is zlib?
A zlib is a library which provides the function to compress and decompress file during the program compilation.
To install zlib1-g dev is a piece of cake for Ubuntu & Debian and RPM User they just need to pass the one line of command, and the issue gets to resolve.
How zlib works?
Data compressed using zlib are written in gzip or zlib wrapper. zlib is an abstraction of DEFLATE compression algorithm of gzip file compression tool. Zlib wrapper encapsulates the raw DEFLATE data by adding a header and trailer. The header size using in gzip is larger than the size of the zlib header.
To install zlib in your system, open the terminal using
CTRL + ALT + T or search terminal in the Activity search bar.
For Ubuntu/Debian User
$ sudo apt install zlib1g-dev
For Centos/Fedora and RPM
$ sudo yum install zlib-devel
Once you pass the above line package manager will install the libraries and the problem will be resolved.
That’s all to resolve zipimport.ZipImportError: can’t decompress data; zlib not available. In case you need some assistance from my end, feel free to comment down.