Search code examples
pythonpipgziptar

ReadError while installing using pip and tar.gz


I have been trying to install something using

pip3 install http://gitlab.com/company/projects/package/-/archive/latest/package-latest.tar.gz

and it's giving me following error.

OSError: Not a gzipped file (b'<!')

Some tracebacks and then.

tarfile.ReadError: not a gzip file

But when I am downloading package-latest.tar.gz and then install it with pip install package-latest.tar.gz it is working fine.


Solution

  • Could it be that some authentication / authorization (password) is required to access this URL? That could explain that an HTML page is sent back as an error message (those commonly start with <!) since pip is not authorized.

    If it is indeed the case, you would need to figure out how to pass the credentials to the server via pip. Maybe something like the following can help (but there are probably other, better solutions):

    It could also be any other (temporary) issue in the client/server communication, so that the server might not be able to serve the file and just sends back some error message as HTML.