0
System:    Kernel: 5.4.0-65-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.6.7 
           wm: muffin dm: LightDM Distro: Linux Mint 20 Ulyana base: Ubuntu 20.04 focal 

I was under the impression that itertools was already installed? If that's the case, has imap been removed?

The full error message

Exception has occurred: ImportError
cannot import name 'imap' from 'itertools' (unknown location)
  File "/address/program.py", line 10, in <module>
    from itertools import imap```

1 Answers1

1

The Python 3 version of itertools doesn't have an imap() function, but the Python 2 version did.

In Python 3 the built-in map() function has the same functionality.

My guess is that your code is written in Python 2 but you are trying to (accidentally) run it with Python 3.

Check python --version, or, if you want to be absolutely sure, run

python -c "import sys; print(sys.path)"
Paul P
  • 3,346
  • 2
  • 12
  • 26