How to deal with enum compatibility errors

Causes and remedies for errors that occurred when installing Optuna

The environment is as follows

I got an error when I ran the following code to install Optuna

Execution statement


pip install optuna

Execution result


Collecting optuna
  Downloading https://files.pythonhosted.org/packages/33/32/266d4afd269e3ecd7fcc595937c1733f65eae6c09c3caea74c0de0b88d78/optuna-1.5.0.tar.gz (200kB)
     |████████████████████████████████| 204kB 1.7MB/s
Collecting alembic
  Downloading https://files.pythonhosted.org/packages/60/1e/cabc75a189de0fbb2841d0975243e59bde8b7822bacbb95008ac6fe9ad47/alembic-1.4.2.tar.gz (1.1MB)
     |████████████████████████████████| 1.1MB 6.4MB/s
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\Users\(user_name)\Anaconda3\python.exe' 'D:\Users\(user_name)\Anaconda3\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\(user_name)\AppData\Local\Temp\pip-build-env-5wsdb490\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (14 lines):
  Traceback (most recent call last):
    File "D:\Users\(user_name)\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "D:\Users\(user_name)\Anaconda3\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "D:\Users\(user_name)\Anaconda3\lib\site-packages\pip\__main__.py", line 16, in <module>
      from pip._internal.main import main as _main  # isort:skip # noqa
    File "D:\Users\(user_name)\Anaconda3\lib\site-packages\pip\_internal\main.py", line 8, in <module>
      import locale
    File "D:\Users\(user_name)\Anaconda3\lib\locale.py", line 16, in <module>
      import re
    File "D:\Users\(user_name)\Anaconda3\lib\re.py", line 142, in <module>
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Users\(user_name)\Anaconda3\python.exe' 'D:\Users\(user_name)\Anaconda3\lib\site-packages\pip'
 install --ignore-installed --no-user --prefix 'C:\Users\(user_name)\AppData\Local\Temp\pip-build-env-5wsdb490\overlay' --no-warn-script-location 
--no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

error contents

Error statement


ERROR: Command errored out with exit status 1: 'D:\Users\(user_name)\Anaconda3\python.exe' 'D:\Users\(user_name)\Anaconda3\lib\site-packages\pip'
 install --ignore-installed --no-user --prefix 'C:\Users\(user_name)\AppData\Local\Temp\pip-build-env-5wsdb490\overlay' --no-warn-script-location 
--no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

Cause

The standard library enum module is used instead of the enum34 package, and since Python 3.6, the enum34 library is no longer compatible with the standard library enum.

solution

When using Python3.6 or later, the enum34 library is also unnecessary, so uninstall it and use the enum module of the standard library.

Uninstall enum34


pip uninstall enum34

After uninstalling enum34, I ran pip install optuna again and I was able to install Optuna safely!

Recommended Posts

How to deal with enum compatibility errors
How to deal with DistributionNotFound errors
[Python] How to deal with module errors
How to deal with errors when hitting pip ②
How to deal with run-time errors in subprocess.call
How to deal with imbalanced data
For beginners, how to deal with common errors in keras
How to deal with errors when installing whitenoise and deploying to Heroku
How to deal with errors when installing Python and pip with choco
How to deal with memory leaks in matplotlib.pyplot
can't pickle annoy. How to deal with Annoy objects
How to deal with module'tensorflow' has no attribute'〇〇'
How to deal with SessionNotCreatedException when using Selenium
How to deal with Django's Template Does Not Exist
How to deal with pyenv initialization failure in fish 3.1.0
[EC2] How to deal with errors that selenium cannot execute (No module named selenium)
How to update with SQLAlchemy?
How to cast with Theano
[Python] How to deal with pandas read_html read error
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
2 ways to deal with SessionNotCreatedException
How to deal with Executing transaction: failed in Anaconda
How to Delete with SQLAlchemy?
[Linux] How to deal with garbled characters when viewing files
[AWS] How to deal with "Invalid codepoint" error in CloudSearch
A story about how to deal with the CORS problem
How to deal with UnicodeDecodeError when executing google image download
How to cancel RT with tweepy
How to use virtualenv with PowerShell
How to install python-pip with ubuntu20.04LTS
How to get started with Scrapy
How to get started with Python
How to get started with Django
How to Data Augmentation with PyTorch
How to use FTP with Python
How to calculate date with python
How to install mysql-connector with pip3
How to INNER JOIN with SQLAlchemy
How to install Anaconda with pyenv
How to authenticate with Django Part 2
How to authenticate with Django Part 3
How to deal with python installation error in pyenv (BUILD FAILED)
How to deal with "You have multiple authentication backends configured ..." (Django)
How to install pandas on EC2 (How to deal with MemoryError and PermissionError)
[Python] How to get a value with a key other than value with Enum
How to do arithmetic with Django template
[Blender] How to set shape_key with script
How to title multiple figures with matplotlib
How to get parent id with sqlalchemy
How to add a package with PyCharm
How to install DLIB with 2020 / CUDA enabled
How to use ManyToManyField with Django's Admin
How to use OpenVPN with Ubuntu 18.04.3 LTS
How to use Cmder with PyCharm (Windows)
How to prevent package updates with apt
How to work with BigQuery in Python
How to use Ass / Alembic with HtoA
How to use Japanese with NLTK plot
How to do portmanteau test with python