dvc: AttributeError: module 'enum' has no attribute 'IntFlag'

python 3.6, dvc 0.40.1

on almost any command throws issue (warning?):

Failed to import the site module
Traceback (most recent call last):
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/site.py", line 541, in <module>
    main()
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/site.py", line 522, in main
    known_paths = addusersitepackages(known_paths)
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/site.py", line 282, in addusersitepackages
    user_site = getusersitepackages()
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/site.py", line 258, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/site.py", line 248, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/sysconfig.py", line 608, in get_config_var
    return get_config_vars().get(name)
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/sysconfig.py", line 587, in get_config_vars
    import _osx_support
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/_osx_support.py", line 4, in <module>
    import re
  File "/Users/philippk/anaconda3/envs/py36/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 24 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @Casyfill !

Do you have enum34 installed by any chance? You can check that with pip freeze | grep enum34. If you do, please remove it, it is known to cause issues in many packages.

pip uninstall -y enum34

I have the issue as well. Uninstallation of enum34 solved the issue. I am working in virtual environemnt with Python3.7. In my case the dependent is catboost.

$ pip show enum34   
Name: enum34
Version: 1.1.6
Summary: Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4
Home-page: https://bitbucket.org/stoneleaf/enum34
Author: Ethan Furman
Author-email: ethan@stoneleaf.us
License: BSD License
Location: .../.env/lib/python3.7/site-packages
Requires: 
Required-by: catboost

i also have the same issue of error while working on pycharm i also tried to run pip uninstall enum34 command but it shows me that enum34 was not installed i dont know what to do i have pyhton 3.8 version please help by any other solution THANKS…

what

I have upgraded my python version to 3.7. It is working now. Thanks.

Hi @daskol !

Thanks for reporting this! Looks like catboost shouldn’t install enum34 in newer python versions: https://github.com/catboost/catboost/blob/6550fd5ef349acd08d021f8210e322201b169951/catboost/python-package/setup.py#L30 . It should probably be handled similar to how these guys have fixed it https://github.com/donnemartin/saws/commit/f109bc8f534905797ee44239cb766ea3de4ceb5d . We’ve looked for some kind of preemptive solution on our side, but looks like it should indeed be handled by projects that are actually using enum34.

hi. M having a similar issue but uninstalling unum34 doesn’t solve it, here is my traceback:

Traceback (most recent call last): File “run.py”, line 2, in <module> from wtforms import Form, StringField, TextAreaField, PasswordField, validators File “/home/leeuw/.local/lib/python3.5/site-packages/wtforms/init.py”, line 11, in <module> from wtforms import validators, widgets File “/home/leeuw/.local/lib/python3.5/site-packages/wtforms/validators.py”, line 9, in <module> import email_validator File “/home/leeuw/.local/lib/python3.5/site-packages/email_validator/init.py”, line 6, in <module> import dns.resolver File “/home/leeuw/.local/lib/python3.5/site-packages/dns/resolver.py”, line 32, in <module> import dns.flags File “/home/leeuw/.local/lib/python3.5/site-packages/dns/flags.py”, line 24, in <module> class Flag(enum.IntFlag): AttributeError: module ‘enum’ has no attribute ‘IntFlag’

I have tried to installed enum34 on all my pip instances available on my Synology system. /usr/bin/pip uninstall -y enum34 /usr/bin/pip2 uninstall -y enum34 /usr/bin/pip2.7 uninstall -y enum34 /volume1/@appstore/py3k/usr/local/bin/pip uninstall -y enum34 /volume1/@appstore/py3k/usr/local/bin/pip3 uninstall -y enum34

Always the same: WARNING: Skipping enum34 as it is not installed.

Any other suggestions?

Hi there. I am struggling as well and getting an error at class Modes(enum.IntFlag): AttributeError: module ‘enum’ has no attribute ‘IntFlag’

Any help is appreciated.

/volume1/@appstore/py3k/usr/local/lib/python3.5/enum.py Using Python executable: /volume1/@appstore/py3k/usr/local/bin/python3 Using Python version: 3.5.1 (default, Jan 29 2018, 14:18:59) [GCC 4.9.3 20150311 (prerelease)] Platform: Linux-3.10.105-x86_64-with-glibc2.3.4 PYTHONPATH: None

import sys import enum

def main(argv): print (‘Hello there’, sys.argv[1])

class Modes(enum.IntFlag): Listen = 1

print (‘Hello there’, sys.argv[1])

if name == name: main(sys.argv[1:])

This helped me:

I was able to fix this by adding enum34 = “==1.1.8” to pyproject.toml. Apparently enum34 had a feature in v1.1.8 that avoided this error, but this regressed in v1.1.9+. This is just a workaround though. The better solution would be for packages to use environment markers so you don’t have to install enum34 at all unless needed.

Source: https://github.com/python-poetry/poetry/issues/1122

Life savers. Thanks. Was installing a GTFS parser and old tech was being hung up on something I don’t even remember installing.

I don’t have pip freeze per se, but I was able to reproduce it having the conda env below. Given that it just started to happen, I blame the last lib I installed - halo, but didn’t have a chance so far to check if I am correct

name: py37
channels:
  - anaconda
  - conda-forge
dependencies:
  - anaconda:python=3.7.3
  - anaconda:black
  - anaconda:scikit-learn>=0.21.1
  - anaconda:ipython
  - anaconda:jupyter>=1.0.0
  - anaconda:jupyterlab>=0.35.6
  - anaconda:pandas
  - anaconda:pip
  - anaconda:pytest==4.4.0
  - anaconda:pytest-cov
  - anaconda:pytest-pep8
  - anaconda:pytest-benchmark>=3.2.2
  - pymssql
  - pymysql
  - pyyaml
  - conda-forge:fiona>=1.8.6
  - conda-forge:geopandas>=0.5.0
  - conda-forge:s3fs
  - conda-forge:jsonschema=2.6.0
  - conda-forge:luigi
  - conda-forge:sendgrid=5.6.0
  - conda-forge:tqdm
  - conda-forge:xlsxwriter
  - conda-forge:hypothesis  
  - pip:
    - halo
    - envkey
    - dvc
    - snowflake-sqlalchemy
prefix: /Users/philippk/anaconda3/envs/py37