Can't Install psutil - python

Can someone help me understand why I can't install psutil? I'm on MacOS. I'm a noob so bear with me, but any help would be appreciated. Could it be something to do with the default Python install vs v3 that I installed? I'm new to command line so confused about what is causing the error and how to fix it...
This is the error message I get...
kasey#MacBook-Pro ~ % pip3 install psutil
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting psutil
Downloading psutil-5.7.0.tar.gz (449 kB)
|████████████████████████████████| 449 kB 150 kB/s
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/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 /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-wheel-dsejsf
cwd: /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/
Complete output (43 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-2.7
creating build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
creating build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.15-x86_64-2.7
creating build/temp.macosx-10.15-x86_64-2.7/psutil
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch/osx
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-2.7/psutil/_psutil_common.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-record-O5uazE/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/kasey/Library/Python/2.7/include/python2.7/psutil
cwd: /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/
Complete output (43 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-2.7
creating build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
creating build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.15-x86_64-2.7
creating build/temp.macosx-10.15-x86_64-2.7/psutil
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch/osx
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-2.7/psutil/_psutil_common.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-record-O5uazE/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/kasey/Library/Python/2.7/include/python2.7/psutil Check the logs for full command output.

This happens when you have multiple versions installed (as for me, I had python 3.5 along with 3.7 installed), you have to specify a granular version, like so (for 3.7):
sudo apt-get install python3.7-dev -y
Read more:
https://github.com/giampaolo/psutil/issues/1143#issuecomment-334695523

For the same issue on AWS for python3, you will likely need to specify the version more explicitly:
yum install python36-devel.x86_64
Or just search for the right package name:
yum search python | grep -i dev

Related

miniconda docker image creation failing on pip

Context:
Creating a docker image from miniconda3, and installing additional conda and pip packages using conda create env via the dockerfile.
The below is the error that I am getting:
Pip subprocess error:
ERROR: Complete output from command /opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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-gj0mtsb8 --python-tag cp36:
ERROR: running bdist_wheel
The environment.yml contains conda packages and then the pip dependencies. All conda packages comes in fine, but the first Pip installation fails as above.
The Dockerfile is as below:
FROM continuumio/miniconda3
WORKDIR /.
COPY ./environment.yml ./
RUN conda env create -f ./environment.yml
RUN echo "source activate processenv" > ~/.bashrc
ENV PATH /opt/conda/envs/newenv/bin:$PATH
Full error as below:
Pip subprocess error:
ERROR: Complete output from command /opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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-gj0mtsb8 --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.6/psutil
creating build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.6/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -B /opt/conda/envs/newenv/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/conda/envs/processenv/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
ERROR: flair 0.4.4 has requirement urllib3<1.25,>=1.20, but you'll have urllib3 1.25.3 which is incompatible.
ERROR: Complete output from command /opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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-f2xrpwn0/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.6/psutil
creating build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.6/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -B /opt/conda/envs/newenv/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/conda/envs/processenv/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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-f2xrpwn0/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ouoxn_g_/psutil/
CondaEnvException: Pip failed
you have a dependency issue as stated in your error:
ERROR: flair 0.4.4 has requirement urllib3<1.25,>=1.20, but you'll have urllib3 1.25.3 which is incompatible.
you could try adding pip install "urllib3==1.24"
i had to get gcc also installed since miniconda3 does not come with that, i guess. so in the dockerfile gave a apt get for gcc and it worked!

Error installing mysqclient for python 3.7.5 on ubuntu 18.04

this is the error i'm getting:
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(2,0,0,'dev',1) -D__version__=2.0.0dev1 -I/usr/include/mysql -I/usr/include/python3.7m -I/deployment/portfolio/venv/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-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: /deployment/portfolio/venv/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-vbpwzo_w/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-vbpwzo_w/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-i8oey5_m/install-record.txt --single-version-externally-managed --compile --install-headers /deployment/portfolio/venv/include/site/python3.7/mysqlclient
cwd: /tmp/pip-req-build-vbpwzo_w/
Complete output (29 lines):
/deployment/portfolio/venv/lib/python3.7/site-packages/setuptools/dist.py:476: UserWarning: Normalizing '2.0.0dev1' to '2.0.0.dev1'
normalized_version,
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(2,0,0,'dev',1) -D__version__=2.0.0dev1 -I/usr/include/mysql -I/usr/include/python3.7m -I/deployment/portfolio/venv/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /deployment/portfolio/venv/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-vbpwzo_w/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-vbpwzo_w/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-i8oey5_m/install-record.txt --single-version-externally-managed --compile --install-headers /deployment/portfolio/venv/include/site/python3.7/mysqlclient Check the logs for full command output.
i have seen so many questions, and installed so many things as:
python3.7-dev
python3-dev
python-dev
pip install mysqlclient==1.4.2.post1
pip install mysqlclient
sudo apt-get install python3.7-dev default-libmysqlclient-dev
apt-get install python3.7-dev libmysqlclient-dev
sudo apt-get install libssl-dev
pip install mysql-connector-python
nothing seem to work for me, and i don't know what to do anymore, any help is appreciated.
Problem Solved thanks to Nigel Savage, as he suggested i'll list what i did:
Ubuntu version 18.04.03 LTS
VPS: Google cloud instance
python 3.7.5 using virtualenv
apt-get install python3.7-dev
apt-get install python3.7-dev libmysqlclient-dev
apt install build-essential
pip install mysqlclient==1.4.2.post1

Can't pip install psutil (Arch)

I can't find out what the exact problem with the install of psutil is, all errors lead me to very old threads with different versions, or other distros. Mostly missing headers which are included.
$ pip install psutil
Collecting psutil
Using cached https://files.pythonhosted.org/packages/1c/ca/5b8c1fe032a458c2c4bcbe509d1401dca9dda35c7fc46b36bb81c2834740/psutil-5.6.3.tar.gz
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /opt/anaconda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ay_2kk3f/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ay_2kk3f/psutil/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-xsbcm34z --python-tag cp37
cwd: /tmp/pip-install-ay_2kk3f/psutil/
Complete output (61 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
creating build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/psutil
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -I/opt/anaconda/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -I/opt/anaconda/include/python3.7m -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_posix.o
psutil/_psutil_posix.c: In function 'psutil_net_if_flags':
psutil/_psutil_posix.c:415:5: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
415 | strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
psutil/_psutil_posix.c: In function 'psutil_net_if_mtu':
psutil/_psutil_posix.c:376:5: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
376 | strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -I/opt/anaconda/include/python3.7m -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_linux.o
psutil/_psutil_linux.c: In function 'psutil_net_if_duplex_speed':
psutil/_psutil_linux.c:539:5: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
539 | strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -pthread -shared -B /opt/anaconda/compiler_compat -L/opt/anaconda/lib -Wl,-rpath=/opt/anaconda/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/psutil/_psutil_common.o build/temp.linux-x86_64-3.7/psutil/_psutil_posix.o build/temp.linux-x86_64-3.7/psutil/_psutil_linux.o -o build/lib.linux-x86_64-3.7/psutil/_psutil_linux.cpython-37m-x86_64-linux-gnu.so
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Failed to build psutil
ERROR: spyder 3.3.6 has requirement pyqt5<5.13; python_version >= "3", but you'll have pyqt5 5.13.1 which is incompatible.
ERROR: spyder 3.3.6 has requirement pyqtwebengine<5.13; python_version >= "3", but you'll have pyqtwebengine 5.13.1 which is incompatible.
Installing collected packages: psutil
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /opt/anaconda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ay_2kk3f/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ay_2kk3f/psutil/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-g9lzx155/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-ay_2kk3f/psutil/
Complete output (61 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
creating build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/psutil
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -I/opt/anaconda/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -I/opt/anaconda/include/python3.7m -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_posix.o
psutil/_psutil_posix.c: In function 'psutil_net_if_flags':
psutil/_psutil_posix.c:415:5: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
415 | strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
psutil/_psutil_posix.c: In function 'psutil_net_if_mtu':
psutil/_psutil_posix.c:376:5: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
376 | strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -I/opt/anaconda/include/python3.7m -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_linux.o
psutil/_psutil_linux.c: In function 'psutil_net_if_duplex_speed':
psutil/_psutil_linux.c:539:5: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
539 | strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -pthread -shared -B /opt/anaconda/compiler_compat -L/opt/anaconda/lib -Wl,-rpath=/opt/anaconda/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/psutil/_psutil_common.o build/temp.linux-x86_64-3.7/psutil/_psutil_posix.o build/temp.linux-x86_64-3.7/psutil/_psutil_linux.o -o build/lib.linux-x86_64-3.7/psutil/_psutil_linux.cpython-37m-x86_64-linux-gnu.so
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.7/psutil/_psutil_common.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/anaconda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ay_2kk3f/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ay_2kk3f/psutil/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-g9lzx155/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
You might not have not installed python3.7-dev
You can install it using pip3 install python3.7-dev
Before that you can upgrade pip using pip install -U pip

Cant install mysqlclient on MacOS

I am trying to run my windows created python script on MacOS.
I have managed to install all of the needed modules apart from MySQLdb.
I am trying to install from pip3 using this command:
pip3 install mysqlclient
But get a massive error:
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/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 /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-wheel-md6mses2 --python-tag cp37
cwd: /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/
Complete output (30 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/MySQLdb
xcrun -sdk macosx clang -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o
xcrun -sdk macosx clang -arch x86_64 -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'xcrun' 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: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/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 /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-record-zi37f1af/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/MySQLdb
xcrun -sdk macosx clang -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o
xcrun -sdk macosx clang -arch x86_64 -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'xcrun' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-install-cbceeulv/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 /private/var/folders/11/bj20_z594y1562dx9p3bc4km0000gn/T/pip-record-zi37f1af/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
I have tried multiple forum posts that I have found and nothing is working. I have also tried to build from Source but I get an error about ConfigParser not being installed - which it has been via pip.
Please could someone help?!
P.S Pip has been updated to the latest version.
try this:
brew install mysql
or
https://github.com/PyMySQL/mysqlclient-python/issues/169

Fatal error: 'my_config.h' file not found on Mac Mojave during install of Python MySQL

I have a project which has a dependency on MySQL-python==1.2.5
I have checked out answers like this, this and this. However none of the steps mentioned in all those answers helped.
So this project is a Django application with a dependency on MySQL-python as mentioned above. The project is in Python 2.7 and cannot be upgraded to Python 3.X.
When I run,
pip install MySQL-python
I get the below as the error:
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... error
Complete output from command /Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/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 /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-wheel-e63D7H --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Failed building wheel for MySQL-python
Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
Complete output from command /Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-record-gOGq_n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user.m2/.virtualenvs/del/include/site/python2.7/MySQL-python:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-record-gOGq_n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user.m2/.virtualenvs/del/include/site/python2.7/MySQL-python" failed with error code 1 in /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/
I have tried using a different virtual env, tried updating homebrew before doing the above steps. I still cant get this to install.
Is there any way to get this working?
This procedure worked for me:
brew remove mysql
brew install mysql#5.7
brew link --force mysql#5.7
pip install mysql-python
I read a post and adjusted the procedure to link things in the /usr/local/bin instead of adding a new route to the PATH variable.
Reference: MacOS: "pip install MySQL-python" returning an error: "_mysql.c:44:10: fatal error: 'my_config.h' file not found"

Categories

Resources