I am trying to fix an error:

import version
ModuleNotFoundError: No module named 'version'

So I tried pip install version which gave me the error below:

from itertools import izip_longest
ImportError: cannot import name 'izip_longest'

So going through different forums, I realized I need to update the file using this import argument import izip_longest and update it to import zip_longest.

But that file version.py seems to be a temporary file and I am unable to access it in Windows 10.

C:\TruCalvin\testsfolder>pip install version

Collecting version
Using cached https://files.pythonhosted.org/packages/fd/b6/fa3b2c859d4d8817a106e4272029d78a2afbca0a27139997a4e5515bbf60/version-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Tru~1\AppData\Local\Temp\pip-install-d5jk1cru\version\setup.py", line 4, in <module>
    from version import __version__
  File "C:\Users\Tru~1\AppData\Local\Temp\pip-install-d5jk1cru\version\version.py", line 2, in <module>
    from itertools import izip_longest
ImportError: cannot import name 'izip_longest'

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Tru~1\AppData\Local\Temp\pip-install-d5jk1cru\version\

How do I mitigate this issue and edit the file so that I can run pip install version successfully?

Thanks in advance.

  • Updated Setup tools as below >>> pip install -U setuptools but the error remained. from itertools import izip_longest ImportError: cannot import name 'izip_longest' Command "python setup.py egg_info" failed with error code 1 in C:\Users\Tru~1\AppData\Local\Temp\pip-install-rlj_le73\version\ – Vizag Apr 21 '19 at 13:09


As a rule, pip pulls modules from PyPI. The project you are attempting to install is listed there as version. So rather than using pip, you can simply download the files yourself as a compressed tar.gz archive using the Download files link. In your case, this archive includes version.py.


To alter and then install version.py in Python 3.x:

  • Fully extract version-0.1.1.tar.gz (you can use 7-zip for this on Windows). Note that you will need to go through the process of decompressing the archive twice (once for the original version-0.1.1.tar.gz file, then once for the remaining version-0.1.1.tar file).

  • Find version.py. Replace import izip_longest with import zip_longest, as noted in your original question, and then save version.py.

  • Open a command window in the same folder as version.py (ex. Shift + Right-ClickOpen command window hereinstructions on enabling this feature in Windows 10).

  • Run e.g. python setup.py install to install your altered copy of version.py.


You are likely aware of this, but the reason you are running into the issue with import izip_longest verus import zip_longest is because this module is intended for Python 2.x, not Python 3.x. It is also noted on the module page on PyPi that the module itself is (was) in an "Alpha" stage of development. With that in mind, though not guaranteed, you may still run into issues down the road when actually using the module.

| improve this answer | |
  • It worked Got till that final step, but That final step was what I was doing wrong earlier. 'python setup.py install', I was earlier trying to run <python setup.py egg_info> which is obviously not the correct way. Thank you so much. for your detailed response which helped me here. As you have rightly pointed out, now I have a new error which is a good sign :-) will continue on it. – Vizag Apr 21 '19 at 20:18
  • Lol well I am glad (???) to hear that. Good luck. =) – Anaksunaman Apr 21 '19 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.