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

AttributeError: module 'enum' has no attribute 'IntFlag' #1995

Closed
Casyfill opened this issue May 13, 2019 · 25 comments
Closed

AttributeError: module 'enum' has no attribute 'IntFlag' #1995

Casyfill opened this issue May 13, 2019 · 25 comments

Comments

@Casyfill
Copy link

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'
@efiop
Copy link
Contributor

efiop commented May 13, 2019

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.

@Casyfill
Copy link
Author

Casyfill commented May 13, 2019

got it! hm, now I wonder which package requires it as a dependency (given that everything worked fine 3 days ago)

@shcheklein
Copy link
Member

@efiop is there a workaround on the DVC side we can implement so that we do not depend on the environment in this case?

@efiop
Copy link
Contributor

efiop commented May 13, 2019

@shcheklein As you can see from the traceback, it is not about us per se 🙂 As far as I know, the issue is caused by some old enum34 installed, which breaks the environment basically for everything that is using newer features. @Casyfill Maybe you have enum34 version in your console from the time you've run pip freeze so we could confirm my theory? What we could do is require some newer enum34 version in our setup.py, but, as you know, it won't prevent next installed package from installing old enum34 as a dependency 🙁 We might consider checking it at runtime too, though, but as you can see from the traceback, dvc is not even running yet, so that wouldn't be that useful.

@Casyfill
Copy link
Author

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

@daskol
Copy link

daskol commented May 28, 2019

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

@efiop
Copy link
Contributor

efiop commented May 28, 2019

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 donnemartin/saws@f109bc8 . 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.

@SirPolaris
Copy link

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

@sunbc0120
Copy link

pip uninstall -y enum34

@TheusBoot
Copy link

what

@joshwolff1
Copy link

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: python-poetry/poetry#1122

@ekanters71
Copy link

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:])

@efiop
Copy link
Contributor

efiop commented Jun 5, 2020

@ekanters71 See the recipes above. You just need to uninstall enum34 with pip uninstall -y enum34.

@ekanters71
Copy link

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?

@efiop
Copy link
Contributor

efiop commented Jun 6, 2020

@ekanters71 It is installed somewhere, you need to find it and remove. Sorry, but you are on your own now 🙂

FlippAre added a commit to FlippAre/pynssm that referenced this issue Jun 9, 2020
`enum34` seems to be causing some issues on newer versions of Python, example: iterative/dvc#1995 (comment)

Using a PEP508 environmental marker (https://www.python.org/dev/peps/pep-0508/) to only include for 3.3 or older versions of Python
@ekanters71
Copy link

Thanks for your comments. I am on 3.5. I have tried to remove enum34 and I think it worked but by Code still is causing the same error. I have a bigger program but I have condensed it to the problem
import sys
import enum

Gather our code in a main() function

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:])

It results in:
Hello there test
Traceback (most recent call last):
File "print_args.py", line 20, in
main(sys.argv[1:])
File "print_args.py", line 9, in main
class Modes(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Any help please?

@Gurpreet23-design
Copy link

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.....

@Leeuw-Maluleka
Copy link

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
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
File "/home/leeuw/.local/lib/python3.5/site-packages/wtforms/init.py", line 11, in
from wtforms import validators, widgets
File "/home/leeuw/.local/lib/python3.5/site-packages/wtforms/validators.py", line 9, in
import email_validator
File "/home/leeuw/.local/lib/python3.5/site-packages/email_validator/init.py", line 6, in
import dns.resolver
File "/home/leeuw/.local/lib/python3.5/site-packages/dns/resolver.py", line 32, in
import dns.flags
File "/home/leeuw/.local/lib/python3.5/site-packages/dns/flags.py", line 24, in
class Flag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

@pmrowla
Copy link
Contributor

pmrowla commented Sep 10, 2020

Hi @Leeuw-Maluleka, we no longer support Python 3.5. DVC requires Python 3.6 or later.

@Leeuw-Maluleka
Copy link

Leeuw-Maluleka commented Sep 10, 2020 via email

@efiop
Copy link
Contributor

efiop commented Sep 10, 2020

@Leeuw-Maluleka The issue is in https://github.com/rthalley/dnspython package, not in dvc. I don't think you are using dvc at all. There is not much we can do, you are on your own 🙁

@ogonbat
Copy link

ogonbat commented Nov 14, 2020

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.....

Hi, I have the same issue reported above, I have a virtualenv and enum34 is not installed.
So, i have no options to go forward. someone else have the same problem?

@pared
Copy link
Contributor

pared commented Nov 14, 2020

@ogonbat
What is the output of your dvc version?

@ekanters71
Copy link

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

openstack-mirroring pushed a commit to openstack/python-openstackclient that referenced this issue Dec 8, 2020
pip 20.3 finally includes a proper dependency resolver. Its use is
causing the following error messages on the lower-constraints job:

  ERROR: Cannot install ... because these package versions have
  conflicting dependencies.

  The conflict is caused by:
      bandit 1.1.0 depends on PyYAML>=3.1.0
      cliff 3.4.0 depends on PyYAML>=3.12
      openstacksdk 0.52.0 depends on PyYAML>=3.13

Bump our lower constraint for PyYAML to resolve this issue. With that
resolved, we see a new issue:

  ERROR: Could not find a version that satisfies the requirement
  cryptography>=2.7 (from openstacksdk)
  ERROR: No matching distribution found for cryptography>=2.7

This is less self-explanatory but looking at the lower-constraints for
openstacksdk 0.52.0 shows a dependency on cryptography 2.7 [1], meaning
we need to bump this also.

Next up, flake8-import-order seems to cause the dependency resolver to
go nuts, eventually ending with the following error message in a Python
3.6 environment:

  Using cached enum34-1.1.2.zip (49 kB)
    ERROR: Command errored out with exit status 1:
     command: ...
         cwd: ...
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File ".../lib/python3.6/site-packages/setuptools/__init__.py", line 7, in <module>
        import setuptools.distutils_patch  # noqa: F401
      File ".../lib/python3.6/site-packages/setuptools/distutils_patch.py", line 9, in <module>
        import re
      File "/usr/lib64/python3.6/re.py", line 142, in <module>
        class RegexFlag(enum.IntFlag):
    AttributeError: module 'enum' has no attribute 'IntFlag'
    ----------------------------------------

A quick Google suggests this is because the enum34 package is not
complete [2]. We shouldn't even be using it since our base virtualenv
should at least use Python 3.6, but I guess some dependency doesn't
properly restrict the dependency to <= Python 3.4. This is moved from
'test-requirements.txt' to 'tox.ini' since we don't need to use our
constraints machinery for linters.

Finally, the versions of bandit and hacking that pip is bringing in both
requires in a newer version of babel, which in turn requires a new
version of pytz.

  Collecting hacking>=2.0.0
  ...
  ERROR: Cannot install oslo.i18n because these package versions have
  conflicting dependencies.
  The conflict is caused by:
      babel 2.9.0 depends on pytz>=2015.7
      babel 2.8.1 depends on pytz>=2015.7
      babel 2.8.0 depends on pytz>=2015.7
      babel 2.7.0 depends on pytz>=2015.7

Seeing as we shouldn't be tracking bandit in
lower-constraints, I'm not sure why we're want to bump these
dependencies for just that. As above, we move these dependencies out of
'test-requirements' and into 'tox.ini' since we can do that for linters.

[1] https://opendev.org/openstack/openstacksdk/src/tag/0.52.0/requirements.txt#L19
[2] iterative/dvc#1995 (comment)

Change-Id: I8ec738fbcabc8d8553db79a876e5592576cd18fa
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Dec 8, 2020
* Update python-openstackclient from branch 'master'
  to 20769cd7b27d51da84a324a17922427eba5c6eac
  - Fix lower-constraints job
    
    pip 20.3 finally includes a proper dependency resolver. Its use is
    causing the following error messages on the lower-constraints job:
    
      ERROR: Cannot install ... because these package versions have
      conflicting dependencies.
    
      The conflict is caused by:
          bandit 1.1.0 depends on PyYAML>=3.1.0
          cliff 3.4.0 depends on PyYAML>=3.12
          openstacksdk 0.52.0 depends on PyYAML>=3.13
    
    Bump our lower constraint for PyYAML to resolve this issue. With that
    resolved, we see a new issue:
    
      ERROR: Could not find a version that satisfies the requirement
      cryptography>=2.7 (from openstacksdk)
      ERROR: No matching distribution found for cryptography>=2.7
    
    This is less self-explanatory but looking at the lower-constraints for
    openstacksdk 0.52.0 shows a dependency on cryptography 2.7 [1], meaning
    we need to bump this also.
    
    Next up, flake8-import-order seems to cause the dependency resolver to
    go nuts, eventually ending with the following error message in a Python
    3.6 environment:
    
      Using cached enum34-1.1.2.zip (49 kB)
        ERROR: Command errored out with exit status 1:
         command: ...
             cwd: ...
        Complete output (9 lines):
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File ".../lib/python3.6/site-packages/setuptools/__init__.py", line 7, in <module>
            import setuptools.distutils_patch  # noqa: F401
          File ".../lib/python3.6/site-packages/setuptools/distutils_patch.py", line 9, in <module>
            import re
          File "/usr/lib64/python3.6/re.py", line 142, in <module>
            class RegexFlag(enum.IntFlag):
        AttributeError: module 'enum' has no attribute 'IntFlag'
        ----------------------------------------
    
    A quick Google suggests this is because the enum34 package is not
    complete [2]. We shouldn't even be using it since our base virtualenv
    should at least use Python 3.6, but I guess some dependency doesn't
    properly restrict the dependency to <= Python 3.4. This is moved from
    'test-requirements.txt' to 'tox.ini' since we don't need to use our
    constraints machinery for linters.
    
    Finally, the versions of bandit and hacking that pip is bringing in both
    requires in a newer version of babel, which in turn requires a new
    version of pytz.
    
      Collecting hacking>=2.0.0
      ...
      ERROR: Cannot install oslo.i18n because these package versions have
      conflicting dependencies.
      The conflict is caused by:
          babel 2.9.0 depends on pytz>=2015.7
          babel 2.8.1 depends on pytz>=2015.7
          babel 2.8.0 depends on pytz>=2015.7
          babel 2.7.0 depends on pytz>=2015.7
    
    Seeing as we shouldn't be tracking bandit in
    lower-constraints, I'm not sure why we're want to bump these
    dependencies for just that. As above, we move these dependencies out of
    'test-requirements' and into 'tox.ini' since we can do that for linters.
    
    [1] https://opendev.org/openstack/openstacksdk/src/tag/0.52.0/requirements.txt#L19
    [2] iterative/dvc#1995 (comment)
    
    Change-Id: I8ec738fbcabc8d8553db79a876e5592576cd18fa
    Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
ts826848 pushed a commit to ts826848/mssql-cli that referenced this issue Dec 8, 2020
enum34 appears to be a potential source of problems when installed in
environments using Python 3.4 or later [0, 1]. Apparently enum34
1.1.8 was able to avoid these issues, but a regression was introduced in
1.1.9 and is still present in the most recent release [2].

This commit loosens the requirement on enum34 so that it is only
installed if Python 3.3 or older is used.

This particular solution requires setuptools v36.2 or newer [3]. If
older versions of setuptools need to be supported, then the requirements
can be put into an extras_require clause [4, 5].

[0]: python-poetry/poetry#1122
[1]: iterative/dvc#1995
[2]: https://web.archive.org/web/20200621215937/https://bitbucket.org/stoneleaf/enum34/issues/31/make-the-install-a-noop-on-python36
[3]: https://setuptools.readthedocs.io/en/latest/history.html#v36-2-0
[4]: robshakir/pyangbind#232 (comment)
[5]: https://gitlab.com/pycqa/flake8/-/merge_requests/191/diffs
openstack-mirroring pushed a commit to openstack/nova that referenced this issue Dec 19, 2020
This is a combination of 2 commits, as both are needed to unblock
Ussuri gate.

1. [stable-only] lower-contraints: Bump various packages

* amqp==2.5.0 & kombu==4.6.1 via oslo.messaging
  I4b72d8feb85c2b9b4657510c356cd21e22fe40c2

* enum34==1.1.8 to workaround known issues with the package

  The associated repo and issue tracker is currently offline so I can't
  link the actual issue here but it's widely reported elsewhere.

  iterative/dvc#1995

* hacking==3.0.1 introduced via Ie00c10332bd7110169dbb150d601c157b6694d05

* oslo.context==2.22.0 introduced via oslo-policy 3.1.0

* stestr==2.0.0 introduced via oslotest 3.8.0

2. Disable qos resize tempest test for nova-multi-cell job

It turned out that during the qos resize work we did not implemented
support of cross cell resize with qos ports. Tempest test coverage for
the resize and migrate is landed recently that made the nova-multi-cell
job to fail.

So this patch disables the qos resize and migrate tempest tests for the
nova-multi-cell job to unblock the gate.

Related-Bug: #1907522

[1] I8c573c4a11a76932057d8415d76114a03269b9f3
(cherry picked from commit 048250a)

Change-Id: Ib0e09df9d61e42592c2d36ceed7f38c1278c53b2
Closes-Bug: #1907756
openstack-mirroring pushed a commit to openstack/python-openstackclient that referenced this issue Jan 12, 2021
pip 20.3 finally includes a proper dependency resolver. Its use is
causing the following error messages on the lower-constraints job:

  ERROR: Cannot install ... because these package versions have
  conflicting dependencies.

  The conflict is caused by:
      bandit 1.1.0 depends on PyYAML>=3.1.0
      cliff 3.4.0 depends on PyYAML>=3.12
      openstacksdk 0.52.0 depends on PyYAML>=3.13

Bump our lower constraint for PyYAML to resolve this issue. With that
resolved, we see a new issue:

  ERROR: Could not find a version that satisfies the requirement
  cryptography>=2.7 (from openstacksdk)
  ERROR: No matching distribution found for cryptography>=2.7

This is less self-explanatory but looking at the lower-constraints for
openstacksdk 0.52.0 shows a dependency on cryptography 2.7 [1], meaning
we need to bump this also.

Next up, flake8-import-order seems to cause the dependency resolver to
go nuts, eventually ending with the following error message in a Python
3.6 environment:

  Using cached enum34-1.1.2.zip (49 kB)
    ERROR: Command errored out with exit status 1:
     command: ...
         cwd: ...
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File ".../lib/python3.6/site-packages/setuptools/__init__.py", line 7, in <module>
        import setuptools.distutils_patch  # noqa: F401
      File ".../lib/python3.6/site-packages/setuptools/distutils_patch.py", line 9, in <module>
        import re
      File "/usr/lib64/python3.6/re.py", line 142, in <module>
        class RegexFlag(enum.IntFlag):
    AttributeError: module 'enum' has no attribute 'IntFlag'
    ----------------------------------------

A quick Google suggests this is because the enum34 package is not
complete [2]. We shouldn't even be using it since our base virtualenv
should at least use Python 3.6, but I guess some dependency doesn't
properly restrict the dependency to <= Python 3.4. This is moved from
'test-requirements.txt' to 'tox.ini' since we don't need to use our
constraints machinery for linters.

Finally, the versions of bandit and hacking that pip is bringing in both
requires in a newer version of babel, which in turn requires a new
version of pytz.

  Collecting hacking>=2.0.0
  ...
  ERROR: Cannot install oslo.i18n because these package versions have
  conflicting dependencies.
  The conflict is caused by:
      babel 2.9.0 depends on pytz>=2015.7
      babel 2.8.1 depends on pytz>=2015.7
      babel 2.8.0 depends on pytz>=2015.7
      babel 2.7.0 depends on pytz>=2015.7

Seeing as we shouldn't be tracking bandit in
lower-constraints, I'm not sure why we're want to bump these
dependencies for just that. As above, we move these dependencies out of
'test-requirements' and into 'tox.ini' since we can do that for linters.

Modifications:
  tox.ini

NOTE(stephenfin): A cap is placed on the version of hacking used to
prevent us bringing in 4.0.0, which requires additional fixes.

[1] https://opendev.org/openstack/openstacksdk/src/tag/0.52.0/requirements.txt#L19
[2] iterative/dvc#1995 (comment)

Change-Id: I8ec738fbcabc8d8553db79a876e5592576cd18fa
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
(cherry picked from commit 20769cd)
openstack-mirroring pushed a commit to openstack/python-openstackclient that referenced this issue Jan 21, 2021
pip 20.3 finally includes a proper dependency resolver. Its use is
causing the following error messages on the lower-constraints job:

  ERROR: Cannot install ... because these package versions have
  conflicting dependencies.

  The conflict is caused by:
      bandit 1.1.0 depends on PyYAML>=3.1.0
      cliff 3.4.0 depends on PyYAML>=3.12
      openstacksdk 0.52.0 depends on PyYAML>=3.13

Bump our lower constraint for PyYAML to resolve this issue. With that
resolved, we see a new issue:

  ERROR: Could not find a version that satisfies the requirement
  cryptography>=2.7 (from openstacksdk)
  ERROR: No matching distribution found for cryptography>=2.7

This is less self-explanatory but looking at the lower-constraints for
openstacksdk 0.52.0 shows a dependency on cryptography 2.7 [1], meaning
we need to bump this also.

Next up, flake8-import-order seems to cause the dependency resolver to
go nuts, eventually ending with the following error message in a Python
3.6 environment:

  Using cached enum34-1.1.2.zip (49 kB)
    ERROR: Command errored out with exit status 1:
     command: ...
         cwd: ...
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File ".../lib/python3.6/site-packages/setuptools/__init__.py", line 7, in <module>
        import setuptools.distutils_patch  # noqa: F401
      File ".../lib/python3.6/site-packages/setuptools/distutils_patch.py", line 9, in <module>
        import re
      File "/usr/lib64/python3.6/re.py", line 142, in <module>
        class RegexFlag(enum.IntFlag):
    AttributeError: module 'enum' has no attribute 'IntFlag'
    ----------------------------------------

A quick Google suggests this is because the enum34 package is not
complete [2]. We shouldn't even be using it since our base virtualenv
should at least use Python 3.6, but I guess some dependency doesn't
properly restrict the dependency to <= Python 3.4. This is moved from
'test-requirements.txt' to 'tox.ini' since we don't need to use our
constraints machinery for linters.

Finally, the versions of bandit and hacking that pip is bringing in both
requires in a newer version of babel, which in turn requires a new
version of pytz.

  Collecting hacking>=2.0.0
  ...
  ERROR: Cannot install oslo.i18n because these package versions have
  conflicting dependencies.
  The conflict is caused by:
      babel 2.9.0 depends on pytz>=2015.7
      babel 2.8.1 depends on pytz>=2015.7
      babel 2.8.0 depends on pytz>=2015.7
      babel 2.7.0 depends on pytz>=2015.7

Seeing as we shouldn't be tracking bandit in
lower-constraints, I'm not sure why we're want to bump these
dependencies for just that. As above, we move these dependencies out of
'test-requirements' and into 'tox.ini' since we can do that for linters.

Conflicts:
  lower-constraints.txt
  test-requirements.txt

NOTE(stephenfin): Conflicts are due to the absence of ddt and presence
of mock in lower-constraints.txt and test-requirements.txt,
respectively.

Modifications:
  lower-constraints.txt

NOTE(stephenfin): There's no need to bump cryptography here since we're
using an older version of openstacksdk.

[1] https://opendev.org/openstack/openstacksdk/src/tag/0.52.0/requirements.txt#L19
[2] iterative/dvc#1995 (comment)

Change-Id: I8ec738fbcabc8d8553db79a876e5592576cd18fa
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
(cherry picked from commit 20769cd)
(cherry picked from commit 83cd9b5)
@pycharmer1221
Copy link

i faced the same issue,
i was using VSCODE and python 3.8.10,

i had file called enum.py that i created for storing enums for pydantic,
but when i created file everything was working fine,

but when i reopen the same notebook, and kernal was not starting,
most of the solutions are to uninstall enum but it was not installed.

so i deleted enum.py file, and it started working again,
after that i checked that if you have enum file even in sub-directory ie where you are using notebook,
it shows that error

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