Getting below error in AWS deployment "AttributeError: module 'enum' has no attribute 'IntFlag'".(Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1) Detailed Log Below . I am using python 3.6 and using kiteconnect==3.8.2 in requirements.txt file while deploying AWS EB Instance .
------------------------------------------ log file ---------------------- ------------------------------------------------------------------------------------------------------------------- Building wheels for collected packages: kiteconnect, retrying Building wheel for kiteconnect (setup.py): started Building wheel for kiteconnect (setup.py): finished with status 'done' WARNING: Legacy build of wheel for 'kiteconnect' created no files. Command arguments: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ke_vxv7x/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ke_vxv7x/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ecjqb8li Command output: [use --verbose to show] Running setup.py clean for kiteconnect Building wheel for retrying (setup.py): started Building wheel for retrying (setup.py): finished with status 'done' Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=9532 sha256=9c6775a184c1d5583a211dfc4ea159c68255d5b92cc4ead9493a75c48484f709 Stored in directory: /root/.cache/pip/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf Running setup.py install for kiteconnect: started Running setup.py install for kiteconnect: finished with status 'error' ERROR: Command errored out with exit status 1: command: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ke_vxv7x/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ke_vxv7x/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-adhizmx3/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect cwd: /tmp/pip-install-ke_vxv7x/kiteconnect/ Complete output (9 lines): Traceback (most recent call last): File "", line 1, in File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/__init__.py", line 3, in from fnmatch import fnmatchcase File "/opt/python/run/venv/lib64/python3.6/fnmatch.py", line 14, in import re File "/opt/python/run/venv/lib64/python3.6/re.py", line 142, in class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag' ---------------------------------------- ERROR: Command errored out with exit status 1: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ke_vxv7x/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ke_vxv7x/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-adhizmx3/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect Check the logs for full command output. 2020-09-13 03:43:45,438 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please let me know how to get it installed , its working fine in Local Ubuntu Unix machine . Since I have to use it in deployment in aws Elasticbeanstalk so please suggest someways to overcome this .
"AttributeError: module 'enum' has no attribute 'IntFlag'"
As the error message states, it seems to be because of enum py package. You can try uninstall enum by pip uninstall -y enum34 and then do fresh installation.
(Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1)
Also, as the stack trace suggests, the above error is generated while installing the required dependency from the requirements file. So, you need to look into each dependency and debug its installation. If enum is the reason, try removing it from the requirements file(if available).
@rakeshr still same error i have removed the enum34 from my requirements.txt.(Attached requirements.txt)Any other kite connect version you know which is stable in python3.6 ----------------------log Requirement already satisfied: setuptools>=41.2.0 in /opt/python/run/venv/lib/python3.6/site-packages (from investpy->-r /opt/python/ondeck/app/requirements.txt (line 28)) (50.3.0) Collecting enum34>=1.1.6 Downloading enum34-1.1.10-py3-none-any.whl (11 kB) Requirement already satisfied: pip>=18.0 in /opt/python/run/venv/lib/python3.6/site-packages (from pipenv==2020.6.2->-r /opt/python/ondeck/app/requirements.txt (line 42)) (20.2.3) Requirement already satisfied: importlib-resources>=1.0; python_version < "3.7" in /opt/python/run/venv/lib/python3.6/site-packages (from virtualenv==20.0.26->-r /opt/python/ondeck/app/requirements.txt (line 68)) (3.0.0) Building wheels for collected packages: kiteconnect, retrying Building wheel for kiteconnect (setup.py): started Building wheel for kiteconnect (setup.py): finished with status 'done' WARNING: Legacy build of wheel for 'kiteconnect' created no files. Command arguments: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-41ix1k84 Command output: [use --verbose to show] Running setup.py clean for kiteconnect Building wheel for retrying (setup.py): started Building wheel for retrying (setup.py): finished with status 'done' Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=9532 sha256=6c3392994eb699dc99d81e801b0d28ba498b145a267b70028f0780130756ff5c Stored in directory: /root/.cache/pip/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf Successfully built retrying Failed to build kiteconnect Installing collected packages: APScheduler, attrs, txaio, pycparser, cffi, cryptography, autobahn, Automat, cachelib, constantly, Flask-Session, hyperlink, incremental, investpy, zope.interface, PyHamcrest, Twisted, pyOpenSSL, enum34, kiteconnect, retrying, plotly, pyasn1, pyasn1-modules, service-identity Attempting uninstall: investpy Found existing installation: investpy 0.9.14 Uninstalling investpy-0.9.14: Successfully uninstalled investpy-0.9.14 Running setup.py develop for investpy Running setup.py install for kiteconnect: started Running setup.py install for kiteconnect: finished with status 'error' ERROR: Command errored out with exit status 1: command: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-pziu6m7_/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect cwd: /tmp/pip-install-xxzkrm1h/kiteconnect/ Complete output (9 lines): Traceback (most recent call last): File "", line 1, in File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/__init__.py", line 3, in from fnmatch import fnmatchcase File "/opt/python/run/venv/lib64/python3.6/fnmatch.py", line 14, in import re File "/opt/python/run/venv/lib64/python3.6/re.py", line 142, in class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag' ---------------------------------------- ERROR: Command errored out with exit status 1: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-pziu6m7_/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect Check the logs for full command output. 2020-09-19 10:05:10,776 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 Traceback (most recent call last): File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main install_dependencies() File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True) File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus) -------------------------------
You still seems to be installing enum34, as per above requirement install log for investpy requirement line 28. It's an issue from 3rd party lib(investpy) not from kiteconnect dependencies.
pip uninstall -y enum34
and then do fresh installation. Also, as the stack trace suggests, the above error is generated while installing the required dependency from the requirements file. So, you need to look into each dependency and debug its installation. If enum is the reason, try removing it from the requirements file(if available).----------------------log
Requirement already satisfied: setuptools>=41.2.0 in /opt/python/run/venv/lib/python3.6/site-packages (from investpy->-r /opt/python/ondeck/app/requirements.txt (line 28)) (50.3.0)
Collecting enum34>=1.1.6
Downloading enum34-1.1.10-py3-none-any.whl (11 kB)
Requirement already satisfied: pip>=18.0 in /opt/python/run/venv/lib/python3.6/site-packages (from pipenv==2020.6.2->-r /opt/python/ondeck/app/requirements.txt (line 42)) (20.2.3)
Requirement already satisfied: importlib-resources>=1.0; python_version < "3.7" in /opt/python/run/venv/lib/python3.6/site-packages (from virtualenv==20.0.26->-r /opt/python/ondeck/app/requirements.txt (line 68)) (3.0.0)
Building wheels for collected packages: kiteconnect, retrying
Building wheel for kiteconnect (setup.py): started
Building wheel for kiteconnect (setup.py): finished with status 'done'
WARNING: Legacy build of wheel for 'kiteconnect' created no files.
Command arguments: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-41ix1k84
Command output: [use --verbose to show]
Running setup.py clean for kiteconnect
Building wheel for retrying (setup.py): started
Building wheel for retrying (setup.py): finished with status 'done'
Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=9532 sha256=6c3392994eb699dc99d81e801b0d28ba498b145a267b70028f0780130756ff5c
Stored in directory: /root/.cache/pip/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf
Successfully built retrying
Failed to build kiteconnect
Installing collected packages: APScheduler, attrs, txaio, pycparser, cffi, cryptography, autobahn, Automat, cachelib, constantly, Flask-Session, hyperlink, incremental, investpy, zope.interface, PyHamcrest, Twisted, pyOpenSSL, enum34, kiteconnect, retrying, plotly, pyasn1, pyasn1-modules, service-identity
Attempting uninstall: investpy
Found existing installation: investpy 0.9.14
Uninstalling investpy-0.9.14:
Successfully uninstalled investpy-0.9.14
Running setup.py develop for investpy
Running setup.py install for kiteconnect: started
Running setup.py install for kiteconnect: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-pziu6m7_/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect
cwd: /tmp/pip-install-xxzkrm1h/kiteconnect/
Complete output (9 lines):
Traceback (most recent call last):
File "", line 1, in
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/__init__.py", line 3, in
from fnmatch import fnmatchcase
File "/opt/python/run/venv/lib64/python3.6/fnmatch.py", line 14, in
import re
File "/opt/python/run/venv/lib64/python3.6/re.py", line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-pziu6m7_/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect Check the logs for full command output.
2020-09-19 10:05:10,776 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
-------------------------------
-----------------------------
investpy
requirement line 28.It's an issue from 3rd party lib(investpy) not from kiteconnect dependencies.