Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'enum' has no attribute 'IntFlag' #1582

Closed
stvogel opened this issue Feb 6, 2019 · 8 comments
Closed

module 'enum' has no attribute 'IntFlag' #1582

stvogel opened this issue Feb 6, 2019 · 8 comments
Assignees

Comments

@stvogel
Copy link

stvogel commented Feb 6, 2019

I'm using dvc 0.24.3 on ubuntu 18.04
When I call: dvc pull
I get:

`$ dvc pull
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
import(pkg_name)
File "/home/xxx/.local/lib/python3.6/site-packages/dvc/init.py", line 72, in
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
File "/usr/lib/python3.6/warnings.py", line 131, in filterwarnings
import re
File "/usr/lib/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
import(pkg_name)
File "/home/xxx/.local/lib/python3.6/site-packages/dvc/init.py", line 72, in
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
File "/usr/lib/python3.6/warnings.py", line 131, in filterwarnings
import re
File "/usr/lib/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Preparing to download data from 's3://xxx/projects/zzz/_dvc_repos'
Preparing to collect status from s3://xxx/projects/zzz/_dvc_repos
[##############################] 100% Collecting information
[##############################] 100% Analysing status.
Data '{'scheme': 'local', 'path': '/home/xxx/projects/zzz/predict_model.log'}' didn't change.
Checking out '{'scheme': 'local', 'path': '/home/xxx/projects/zzz/model2.h5'}' with cache '4945e5c7c8c4939d666056f7238c1c6c'.
Warning: Cache '5edea260bb42368385b85bb2e2e6e210.dir' not found. File '{'scheme': 'local', 'path': '/home/xxx/projects/zzz/models'}' won't be created.
Checking out '{'scheme': 'local', 'path': '/home/xxx/projects/zzz/models/model.json'}' with cache '54f1fb22ba329d9789fc815e4ae855e4'.
Warning: Cache '6551f44ccff789fac35b2ef1eee118b6' not found. File '{'scheme': 'local', 'path': '/home/xxx/projects/zzz/models/model.h5'}' won't be created.
Data '{'scheme': 'local', 'path': '/home/xxx/projects/zzz/data'}' didn't change.
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
import(pkg_name)
File "/home/xxx/.local/lib/python3.6/site-packages/dvc/init.py", line 72, in
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
File "/usr/lib/python3.6/warnings.py", line 131, in filterwarnings
import re
File "/usr/lib/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
import(pkg_name)
File "/home/xxx/.local/lib/python3.6/site-packages/dvc/init.py", line 72, in
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
File "/usr/lib/python3.6/warnings.py", line 131, in filterwarnings
import re
File "/usr/lib/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
`

What's happening here?

@efiop
Copy link
Contributor

efiop commented Feb 6, 2019

Hi @stvogel !

Looks like there is something wrong with your environment. Do you have enum34 installed by any chance? I.e. pip freeze | grep enum.

@efiop
Copy link
Contributor

efiop commented Feb 7, 2019

Ok, this is definitely the fault of enum34, I've tried to install it and was able to reproduce your error. Try uninstalling it with pip uninstall enum34 and you should be fine. Most likely one of the packages(probably gcloud?) you've installed has enum34 as a dependency, which messes up a lot of other packages. 🙁

@efiop efiop self-assigned this Feb 7, 2019
@stvogel
Copy link
Author

stvogel commented Feb 7, 2019

You were right. Uninstalling enum34 did the trick. Thanks a lot for your fast help.

@sbaktha
Copy link

sbaktha commented Dec 28, 2019

Hi, is there any other way to fix this? I have ros-melodic and removing enum is causing ros to be uninstalled

@efiop
Copy link
Contributor

efiop commented Dec 28, 2019

@sbaktha Unfortunately, there is no way to fix or mitigate that on our side. The issue is with ros-melodic package, because it is using enum34, which shouldn't be used in newer python versions. Please consider contacting ros-melodic maintainers/developers. You could probably workaround that by using a separate virtualenv for ros-melodic. You could also try using something like pipenv to install dvc into itsown virtuaelnv. If you are on mac you could consider installing dvc from homebrew or if you are on linux - from deb/rpm packages. Both of those are isolated, so should also mitigate that issue for you. Please let us know if any of those work for you or not. 🙂

@n5596
Copy link

n5596 commented Feb 5, 2020

I had ros-melodic and since removing enum was causing ros to be uninstalled, I just uninstalled miniconda3. That fixed the issue.

@Evidlo
Copy link

Evidlo commented Mar 10, 2020

@sbaktha Use two virtual environments so you can have two enum34 versions installed.

@wmbolle
Copy link

wmbolle commented Apr 12, 2020

The problem is that the ROS environment modifies the PYTHONPATH. That not only affects Python2 but also Python3. For Python3, you can either temporarily reset PYTHONPATH or fix sys.path at the beginning your Python3 script. Here is what I did:

import sys
for ix in range(0, len(sys.path)):
if 'python2' in sys.path[ix]:
sys.path[ix] = sys.path[ix].replace('python2', 'pythonX')
print('sys.path: {0}'.format(sys.path))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants