I am new to the coding world and trying to build my skills in Python as a stepping stone for Data Analytics.
I am facing a problem in installing Dash module on my local machine. The error where it is getting stuck is 'Failed building wheel for brotli'
I am using Windows 10 / Python 3.9.0 / PIP 20.2.4 / pycharm.
I have been able to successfully install plotly and while installing dash module - first I got the error of 'wheel' not installing - which got rectified by installing wheel module (pip install wheel). Later the error for dash was 'Failed building wheel for brotli'. Had tried installing using command prompt(pip) as well as PyCharm.
Can someone please help. Below is the log that I am getting.
C:\WINDOWS\system32>pip install dash
Requirement already satisfied: dash in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (0.17.7)
Requirement already satisfied: Flask>=0.12 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from dash) (1.1.2)
Requirement already satisfied: plotly in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from dash) (4.14.1)
Requirement already satisfied: flask-compress in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages\flask_compress-1.8.0-py3.9.egg (from dash) (1.8.0)
Requirement already satisfied: flask-seasurf in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from dash) (0.2.2)
Requirement already satisfied: Jinja2>=2.10.1 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from Flask>=0.12->dash) (2.11.2)
Requirement already satisfied: click>=5.1 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from Flask>=0.12->dash) (7.1.2)
Requirement already satisfied: itsdangerous>=0.24 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from Flask>=0.12->dash) (1.1.0)
Requirement already satisfied: Werkzeug>=0.15 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from Flask>=0.12->dash) (1.0.1)
Requirement already satisfied: six in c:\users\arinjay jaiswal\appdata\roaming\python\python39\site-packages (from plotly->dash) (1.15.0)
Requirement already satisfied: retrying>=1.3.3 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from plotly->dash) (1.3.3)
Collecting brotli
Using cached Brotli-1.0.9.zip (510 kB)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\arinjay jaiswal\appdata\local\programs\python\python39\lib\site-packages (from Jinja2>=2.10.1->Flask>=0.12->dash) (1.1.1)
Building wheels for collected packages: brotli
Building wheel for brotli (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\arinjay jaiswal\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Arinjay Jaiswal\\AppData\\Local\\Temp\\pip-install-4jna0pqh\\brotli\\setup.py'"'"'; __file__='"'"'C:\\Users\\Arinjay Jaiswal\\AppData\\Local\\Temp\\pip-install-4jna0pqh\\brotli\\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 'C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-wheel-t7_2ranf'
cwd: C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-install-4jna0pqh\brotli\
Complete output (18 lines):
running bdist_wheel
running build
running build_py
creating bin
creating bin\lib.win-amd64-3.9
copying python\brotli.py -> bin\lib.win-amd64-3.9
running build_ext
building '_brotli' extension
creating bin\temp.win-amd64-3.9
creating bin\temp.win-amd64-3.9\Release
creating bin\temp.win-amd64-3.9\Release\c
creating bin\temp.win-amd64-3.9\Release\c\common
creating bin\temp.win-amd64-3.9\Release\c\dec
creating bin\temp.win-amd64-3.9\Release\c\enc
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic/include -Ic:\users\arinjay jaiswal\appdata\local\programs\python\python39\include -Ic:\users\arinjay jaiswal\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include /Tcc/common/constants.c /Fobin\temp.win-amd64-3.9\Release\c/common/constants.obj
constants.c
C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-install-4jna0pqh\brotli\c\common\./platform.h(26): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for brotli
Running setup.py clean for brotli
Failed to build brotli
Installing collected packages: brotli
Running setup.py install for brotli ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\arinjay jaiswal\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Arinjay Jaiswal\\AppData\\Local\\Temp\\pip-install-4jna0pqh\\brotli\\setup.py'"'"'; __file__='"'"'C:\\Users\\Arinjay Jaiswal\\AppData\\Local\\Temp\\pip-install-4jna0pqh\\brotli\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-record-lnmkirsr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\arinjay jaiswal\appdata\local\programs\python\python39\Include\brotli'
cwd: C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-install-4jna0pqh\brotli\
Complete output (18 lines):
running install
running build
running build_py
creating bin
creating bin\lib.win-amd64-3.9
copying python\brotli.py -> bin\lib.win-amd64-3.9
running build_ext
building '_brotli' extension
creating bin\temp.win-amd64-3.9
creating bin\temp.win-amd64-3.9\Release
creating bin\temp.win-amd64-3.9\Release\c
creating bin\temp.win-amd64-3.9\Release\c\common
creating bin\temp.win-amd64-3.9\Release\c\dec
creating bin\temp.win-amd64-3.9\Release\c\enc
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic/include -Ic:\users\arinjay jaiswal\appdata\local\programs\python\python39\include -Ic:\users\arinjay jaiswal\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include /Tcc/common/constants.c /Fobin\temp.win-amd64-3.9\Release\c/common/constants.obj
constants.c
C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-install-4jna0pqh\brotli\c\common\./platform.h(26): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\arinjay jaiswal\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Arinjay Jaiswal\\AppData\\Local\\Temp\\pip-install-4jna0pqh\\brotli\\setup.py'"'"'; __file__='"'"'C:\\Users\\Arinjay Jaiswal\\AppData\\Local\\Temp\\pip-install-4jna0pqh\\brotli\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Arinjay Jaiswal\AppData\Local\Temp\pip-record-lnmkirsr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\arinjay jaiswal\appdata\local\programs\python\python39\Include\brotli' Check the logs for full command output.
Related
I have been attempting to deploy my Django project up on AWS ElasticBeanstalk via EB CLI n my local Pycharm project with the built in terminal.
Having setup IAM/group (through aws web console) I migrated and ran server locally (Pycharm terminal) and all works fine, and then created env/instance and requirements.txt and deployed using EB CLI in Pycharm and this also worked fine.
I setup a database connection on RDS (AWS web Console) then changed settings to connect to mysql, pip installed mysqlclient, migrate and ran locally (Pycharm terminal) and again all works fine.
However, when I try to deply the project again with mysqlclient installed I get errors and I just cannot figure out why.
Platform: arn:aws:elasticbeanstalk:us-west-2::platform/Python 3.7 running on 64bit Amazon Linux 2/3.3.7
Requirements.txt
asgiref==3.4.1
cement==2.8.2
certifi==2021.10.8
charset-normalizer==2.0.7
colorama==0.4.3
Django==3.2.9
django-storages==1.12.3
future==0.16.0
idna==3.3
jmespath==0.10.0
mysqlclient
pathspec==0.5.9
python-dateutil==2.8.2
pytz==2021.3
PyYAML==5.4.1
requests==2.26.0
s3transfer==0.5.0
semantic-version==2.8.5
six==1.14.0
sqlparse==0.4.2
termcolor==1.1.0
typing-extensions==3.10.0.2
urllib3==1.26.7
wcwidth==0.1.9
.ebextensions/django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: awsdeploy.wsgi:application
aws:elasticbeanstalk:environment:proxy:staticfiles:
/static: static
container_commands:
01_collectstatic:
command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py collectstatic --noinput --clear"
02_migrate:
command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py migrate --noinput"
leader_only: true
.ebextensions/packages.config
packages:
yum:
python3-devel: []
mariadb-devel: []
EB Error Logs
Collecting mysqlclient==2.0.3
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
2021/11/11 02:10:40.712344 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed wi
th error exit status 1. Stderr: ERROR: Command errored out with exit status 1:
command: /var/app/venv/staging-LQM1lest/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-isj_ea8s/mysqlclient_f221eb2ed3c44d6e868da4539588d2a4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-isj_ea8s/mysqlclient_f221eb2ed3c44d6e868da4539588d2a4/setup.py'"'"';f = ge
tattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hzv5pj6h
cwd: /tmp/pip-install-isj_ea8s/mysqlclient_f221eb2ed3c44d6e868da4539588d2a4/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-isj_ea8s/mysqlclient_f221eb2ed3c44d6e868da4539588d2a4/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-isj_ea8s/mysqlclient_f221eb2ed3c44d6e868da4539588d2a4/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-isj_ea8s/mysqlclient_f221eb2ed3c44d6e868da4539588d2a4/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz#sha256=f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 (from https://pypi.org/simple/mysqlclient/) (requires-python:>=3.5). Command errored out
with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==2.0.3 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2
.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0rc1)
ERROR: No matching distribution found for mysqlclient==2.0.3
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/var/app/venv/staging-LQM1lest/bin/python -m pip install --upgrade pip' command.
2021/11/11 02:10:40.712360 [INFO] Executing cleanup logic
2021/11/11 02:10:40.712489 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed to install application dependencies. The deployment failed.","timestamp
":1636596640,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1636596640,"severity":"ERROR"}]}]}
2021/11/11 02:10:40.712674 [INFO] Platform Engine finished execution on command: app-deploy
I don't understand why prior to installing mysqlclient it's managed to deploy install all my packages from requirements file successfully but fails when mysqlclient was added - what am I missing?
Help is much appreciated, happy to share any other details if needed. Thanks
Edit
I came across the answer on this link: [https://stackoverflow.com/questions/67344766/error-encountered-while-installing-dependencies-for-flask-mysql-application-usin][1]
And created the .ebextensions/packages.config as suggested and removed version from mysqlclient within my requirements.txt file - updated above code.
Now mysqlclient appears to have installed succssfully but now get the following error:
New EB Error Logs
An error occurred during execution of command [app-deploy] - [PostBuildEbExtension]. Stop running the command. Error: container commands build failed. Please refer to /var/log/cfn-init.log for more details.
I'm also not sure how to check this log /var/log/cfn-init.log, when I go to the web console I can't see any eb instances listed or any logs.
I want to use a mysql engine/database with ARA instead of the default sqlite engine that comes with the tool in order to have a more robust engine for multiple entries but I am facing an issue that doesn't allow me to acheive this here below the details :
When i specified mysql engine in the settings.yml file for my ARA server I go the following error :
~/.ara/server # [ara] Using settings file: /root/.ara/server/settings.yaml
Traceback (most recent call last):
File "/root/.local/lib/python3.8/site-packages/ara/server/__main__.py", line 54, in main
import MySQLdb # noqa
ModuleNotFoundError: No module named 'MySQLdb'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/.local/bin/ara-manage", line 8, in <module>
sys.exit(main())
File "/root/.local/lib/python3.8/site-packages/ara/server/__main__.py", line 56, in main
raise MissingMysqlclientException from e
ara.setup.exceptions.MissingMysqlclientException: The mysqlclient python library must be installed in order to use the MySQL database engine.
So I checked if mysqlclient is installed and apparently it is not installed :
~/.ara/server # pip3 list installed | grep mysql
But when I try to install it I have this huge exceptions block:
~/.ara/server # pip3.8 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/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-lm119tma
cwd: /tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/
Complete output (41 lines):
mysql_config --version
['10.5.5']
mysql_config --libs
['-L/usr/lib/', '-lmariadb']
mysql_config --cflags
['-I/usr/include/mysql', '-I/usr/include/mysql/mysql']
ext_options:
library_dirs: ['/usr/lib/']
libraries: ['mariadb']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/include/mysql', '/usr/include/mysql/mysql']
extra_objects: []
define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.8/MySQLdb
creating build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/MySQLdb
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.8/MySQLdb/_mysql.o -std=c99
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/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-ksqr0pbp/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.8/mysqlclient
cwd: /tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/
Complete output (41 lines):
mysql_config --version
['10.5.5']
mysql_config --libs
['-L/usr/lib/', '-lmariadb']
mysql_config --cflags
['-I/usr/include/mysql', '-I/usr/include/mysql/mysql']
ext_options:
library_dirs: ['/usr/lib/']
libraries: ['mariadb']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/include/mysql', '/usr/include/mysql/mysql']
extra_objects: []
define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.8/MySQLdb
creating build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/MySQLdb
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.8/MySQLdb/_mysql.o -std=c99
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oq1ay19g/mysqlclient_f0ad3d21508f4b698b4bfb4e7c70b25d/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-ksqr0pbp/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.8/mysqlclient Check the logs for full command output.
If I understand the error there is a compilation problem due to the abscence of gcc.
But when I try to unstall gcc7 using pip it doesn't work :
~/.ara/server # pip3 install gcc7
ERROR: Could not find a version that satisfies the requirement gcc7
ERROR: No matching distribution found for gcc7
1- So is my analysis right?
2- What could be the real issue behind this? I mean are there other dependencies that might cause this issue.
any help or tip will be greatly appreciated.
P.S: I am working on alpine distribution.
This question already has answers here:
pip install mysqlclient returns "fatal error C1083: Cannot open file: 'mysql.h': No such file or directory
(18 answers)
Closed 2 years ago.
I am trying to install mysqlclient and getting the following error.
C:\Users\Yash Patel>pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Using legacy setup.py install for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\yash patel\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\YASHPA~1\AppData\Local\Temp\pip-record-diaiyo1_\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\yash patel\appdata\local\programs\python\python37-32\Include\mysqlclient'
cwd: C:\Users\YASHPA~1\AppData\Local\Temp\pip-install-sc96zvsc\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\yash patel\appdata\local\programs\python\python37-32\include" "-Ic:\users\yash patel\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\yash patel\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\YASHPA~1\AppData\Local\Temp\pip-record-diaiyo1_\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\yash patel\appdata\local\programs\python\python37-32\Include\mysqlclient' Check the logs for full command output.
You need to have mysql client (the actual db client software) installed on your device. When mysql client is installed the source files will be available for python to compile mysqlclient python module.
There is an alternative for this module. You may install pymysql. However this module is not being recommended for production purposes. This module is pure python so not it would not give the required performance.
If you use pymylsq you need to add 2 lines on the manage.py so you may use runserver.
manage.py
import pymysql
pymysql.install_as_MySQLdb()
...
...
I got an error while installing pyaudio
I have downloaden portaudio but i am not sure where to put it. I am trying to create a SpeechRecognition program that won't work without speechrecognition.
The following error occurs:
C:\Users\lenovo>pip install pyaudio
Collecting pyaudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\lenovo\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-w_ldd4wb\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-w_ldd4wb\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lenovo\AppData\Local\Temp\pip-record-ckrughg6\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\lenovo\AppData\Local\Temp\pip-install-w_ldd4wb\pyaudio\
Complete output (9 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying src\pyaudio.py -> build\lib.win-amd64-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lenovo\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-w_ldd4wb\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-w_ldd4wb\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lenovo\AppData\Local\Temp\pip-record-ckrughg6\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
edit:
I found a solution for windows!
go to https://www.lfd.uci.edu/~gohlke/pythonlibs/
and then press
ctrl + f
to find "pyaudio"
you will get
go and find something like this
PyAudio: bindings for the PortAudio library. Includes ASIO, DS, WMME, WASAPI, WDMKS support. PyAudio‑0.2.11‑cp310‑cp310‑win_amd64.whl PyAudio‑0.2.11‑cp310‑cp310‑win32.whl PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl PyAudio‑0.2.11‑cp39‑cp39‑win32.whl PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl PyAudio‑0.2.11‑cp38‑cp38‑win32.whl PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl PyAudio‑0.2.11‑cp36‑cp36m‑win_amd64.whl PyAudio‑0.2.11‑cp36‑cp36m‑win32.whl PyAudio‑0.2.11‑cp35‑cp35m‑win_amd64.whl PyAudio‑0.2.11‑cp35‑cp35m‑win32.whl PyAudio‑0.2.11‑cp34‑cp34m‑win_amd64.whl PyAudio‑0.2.11‑cp34‑cp34m‑win32.whl PyAudio‑0.2.11‑cp27‑cp27m‑win_amd64.whl PyAudio‑0.2.11‑cp27‑cp27m‑win32.whl
now download the one which is of same version of your python and OS
now after downloading open your cmd/terminal
go to its path and then
pip install <Pyaudio-blablabla> <= your file name
now it will be installed!
Enjoy!
The last line of the stacktrace contains the error:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
This error can be fixed by installing the suggested tools from:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
pip install flask-mysqldb
C:\Users\prince>pip install flask-mysqldb Collecting flask-mysqldb
Using cached
https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from flask-mysqldb) (1.1.1) Collecting mysqlclient (from
flask-mysqldb) Using cached
https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
Requirement already satisfied: Werkzeug>=0.15 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (0.16.0) Requirement already
satisfied: Jinja2>=2.10.1 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (2.10.1) Requirement already
satisfied: itsdangerous>=0.24 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (1.1.0) Requirement already
satisfied: click>=5.1 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (7.0) Requirement already satisfied:
MarkupSafe>=0.23 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Jinja2>=2.10.1->Flask>=0.10->flask-mysqldb) (1.1.1) Installing
collected packages: mysqlclient, flask-mysqldb Running setup.py
install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\prince\appdata\local\programs\python\python37-32\python.exe'
-u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\setup.py'"'"';
file='"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))'
install --record
'C:\Users\prince\AppData\Local\Temp\pip-record-8l4u4qqk\install-record.txt'
--single-version-externally-managed --compile
cwd: C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,4,'final',0)
-D__version__=1.4.4 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\prince\appdata\local\programs\python\python37-32\include -Ic:\users\prince\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.23.28105\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt"
/TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj
/Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe'
failed with exit status 2
---------------------------------------- ERROR: Command errored out with exit status 1:
'c:\users\prince\appdata\local\programs\python\python37-32\python.exe'
-u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\setup.py'"'"';
file='"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))'
install --record
'C:\Users\prince\AppData\Local\Temp\pip-record-8l4u4qqk\install-record.txt'
--single-version-externally-managed --compile Check the logs for full command output.
It didn't worked for me too, but after clicking the link provided by #Suraj Virkar, I noticed that the command for installing is a little different. So instead of using
pip install flask-mysqldb
Just use
pip install Flask-MySQL
and i'm not really sure why but it worked! it must have someting to do with the versions i guess... oh and take note that you'll have to use
from flaskext.mysql import MySQL
to import it on your project instead of using
from flask_mysqldb import MySQL
Hope this helps...
try to install flask-mysqldb by the following method
Installation
pip install flask-mysqldb
if you get error or system cannot fetch wheel file of flask-mysqldb, then go to this link
where you can download wheel file and then run that wheel file.
If this also not working then first install mysqlclient
pip install mysqlclient
and then install flask-mysqldb.