1

I installed a fresh version of pytodos package using pip (pip install pytodos). It requires enum package to be installed, so it was installed automatically. After this had happened every attempt to do anything with pip, that is to install or uninstall any package, resulted in this error:

_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
TypeError: 'type' object is not iterable

But when I removed every file that starts with "enum" from ~/.local/lib/python2.7/site-packages:

cd ~/.local/lib/python2.7/site-packages
rm -rf enum*

..., I was able to install and uninstall packages once again. After installing enum package again (pip install enum), everything repeats.

What could be the cause of such behavior?

Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80
ibodi
  • 1,543
  • 3
  • 21
  • 40

2 Answers2

1

According to https://github.com/pyca/cryptography/issues/4020 you need to uninstall enum and install enum34 or similar instead. Try:

pip install --upgrade enum34
ibodi
  • 1,543
  • 3
  • 21
  • 40
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • As I just said, after installing `enum`, I can't install, **nor uninstall** anything, including `enum`. Only deleting by hand helps. And unfortunately `pytodos` requires `enum`. So, it gets installed whenever I try to install `pytodos`. – ibodi Aug 08 '18 at 12:56
  • What if you remove both, then install `enum34`, then try to install `pytodos`? Does that still automatically install `enum`? If so, this whole thing is a packaging error and you'll need to build `pytodos` yourself. – John Zwinck Aug 08 '18 at 12:59
  • After deleting `enum` (`rm -rf enum*`), uninstalling it (`pip uninstall enum`) gives this message `Skipping enum as it is not installed.`. And attempts to uninstall `enum34` result in appearance of this message: `Cannot uninstall 'enum34'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.`. But when I run `pip install --upgrade enum34`, and then install `pytodos` it still required `enum` and installed it, but further use of pip did not result in any error anymore. – ibodi Aug 08 '18 at 13:13
  • I used `pip install cryptography==2.9` – itiic Apr 17 '20 at 10:45
0

Finally solution is, drop your pip folder, then again reinstall pip and other essential dependencies.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253