Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReadError while installing using pip and tar.gz

Tags:

python

pip

gzip

tar

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.

like image 864
shivankgtm Avatar asked May 20 '26 20:05

shivankgtm


2 Answers

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):

  • https://pip.pypa.io/en/stable/user_guide/#basic-authentication-credentials

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.

like image 96
sinoroc Avatar answered May 23 '26 09:05

sinoroc


Please note that the message implies that the file was downloaded but has some integrity problem that generates the "Not a gzipped file". In my case i found out that python was not downloading the file due to permissions on the server side. Once permissions were granted it worked. In my case would be nice if the message simply indicate that the file was not downloaded.

Please note that I was downloading from my own domain. Using chmod 644 for files and chmod 755 for folders solved the issue.

like image 24
FCastell Avatar answered May 23 '26 11:05

FCastell