Forum Archive

Numpy ‘module enum has no attribute intflag

imnegan

Hi all,

Something strange is happening when I try to import numpy. I have one line of code in my py file, which I created in the default Pythonista location.

import numpy as np

Which returns the following error:

Traceback (most recent call last):
  File "/var/containers/Bundle/Application/D8A31B2E-150C-4276-B4D5-22A9AC389F51/Pythonista3.app/Frameworks/Py3Kit.framework/pykit_startup.py", line 51, in <module>
    main()
  File "/var/containers/Bundle/Application/D8A31B2E-150C-4276-B4D5-22A9AC389F51/Pythonista3.app/Frameworks/Py3Kit.framework/pykit_startup.py", line 47, in main
    import importcompletion
  File "/var/containers/Bundle/Application/D8A31B2E-150C-4276-B4D5-22A9AC389F51/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/importcompletion.py", line 26, in <module>
    import imp
  File "/var/containers/Bundle/Application/D8A31B2E-150C-4276-B4D5-22A9AC389F51/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/imp.py", line 28, in <module>
    import tokenize
  File "/var/containers/Bundle/Application/D8A31B2E-150C-4276-B4D5-22A9AC389F51/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/tokenize.py", line 34, in <module>
    import re
  File "/var/containers/Bundle/Application/D8A31B2E-150C-4276-B4D5-22A9AC389F51/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Any ideas? I have stash installed, but numpy was going just fine when I last used Pythonista a couple of weeks ago.

JonB

delete the enum.py in site packages.

Phuket2

@imnegan , various things regarding things to do with the enum module have been reported before. Have a search on the forum. But the general advice is to check your site-packages dir for a dir called enum and delete it. Then do a full restart of Pythonista, I think you will find it will be ok.
But for more info you can search the forum

dgelessus

The forum's built-in search function is usually quite bad. You can get much better results if you do a site-specific search. For example, in Google or DuckDuckGo, you can add "site:forum.omz-software.com" to the search to restrict it to only the forum.

imnegan

Thanks all.

@JonB I didn't see the enum.py file anywhere, but
@Phuket2 deleting the enum dir nailed it.

@dgelessus amen RE the forum's search function, thanks 'site:' for the google tip.