9

windows 10, python 2.7 64 bit

hello, following a guide to this step :

pip install pipwin
pipwin install pycuda

gives me those options

Package `pycuda` found in cache
Choose version to download.

[0] : 2014.1+cuda6514
[1] : 2015.1.3+cuda7518

no matter what i choose , i get the following error(last line):

  File "c:\users\skpok\anaconda2\lib\zipfile.py", line 811, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file

Anyone knows this mistake?

hmmmbob
  • 1,167
  • 5
  • 19
  • 33

3 Answers3

30

try: pip install --no-cache-dir <package_name>, it will work

when you try to pip install , first pip will check the pip cache for the package. if the package is found and fresh, pip will grap the .whl file for the package and try to install. this results in badzipfile as a .zip file is excepted.

try pip install in verbose mode pip install <some_package> -vvvv. you can see that it will first try to install from cache

  • That is a right solution for the error `BadZipfile: File is not a zip file` when install any packages. – Hùng Ng Vi Jan 27 '18 at 03:26
  • Or just delete your cache: `rm -rf ~/.cache/pip`. It seems that the cache gets corrupted in some cases, and it seems better to delete the corrupted cache than keep working around it. – Elliott Slaughter Aug 28 '20 at 22:37
  • That answer does not sound right. `.whl` files are essentially `.zip` files, i.e. meant to be decoded this way. In fact I have a problem with similar stacktrace whose error is thrown in the parsing of the zip file, i.e. the cached `.whl` seems to actually be corrupt. Your workaround will most likely work but your reasoning seems incorrect to me. – Lukas Juhrich Sep 25 '21 at 03:41
4

Updated:

The download link below is expired. You can find the latest version of pycuda in http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycuda

-------------

I got the same error. Maybe the package is damaged.

Downloading package . . .
http://www.lfd.uci.edu/~gohlke/pythonlibs/WjTMc73K/pycuda-2015.1.3+cuda7518-cp27-none-win32.whl  <--- **damaged package?**

You can download this package:

http://www.lfd.uci.edu/~gohlke/pythonlibs/wkvprmqy/pycuda-2015.1.3+cuda7518-cp27-none-win32.whl

and then:

pip install "pycuda-2015.1.3+cuda7518-cp27-none-win32.whl"

It would be OK.

Kwan
  • 237
  • 1
  • 3
  • 8
1

If it's already installed but older version try to upgrade like so:

#upgrade
pip install -U pycuda 

If didn't work try to uninstall and then install it again, like so:

#uninstall
pip uninstall pycuda 

#install
pip install pycuda 

If didn't work then, Try to install Windows SDK and make sure your CUDA Toolkit is the latest, then install PyCuda again. see if that solve your problem.

Bear
  • 550
  • 9
  • 25