Missing header files while installing packages using pip - python

I was trying to get mysql working with django. Installing the required bindings in an virtualenv using pip generates an error.
pip install MySQL-python
The package gets downloaded but I get the following error saying a header file my_config.h is missing.
(django)[jmathews#localhost pollsys]$ pip install MySQL-python
Downloading/unpacking MySQL-python
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/home/jmathews/.virtualenvs/django/build/MySQL-python/setup.py) egg_info for package MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
_mysql.c:44:23: fatal error: my_config.h: No such file or directory
#include "my_config.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/jmathews/.virtualenvs/django/bin/python -c "import setuptools, tokenize;__file__='/home/jmathews/.virtualenvs/django/build/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Qa0mhq-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/jmathews/.virtualenvs/django/include/site/python2.7:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
_mysql.c:44:23: fatal error: my_config.h: No such file or directory
#include "my_config.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /home/jmathews/.virtualenvs/django/bin/python -c "import setuptools, tokenize;__file__='/home/jmathews/.virtualenvs/django/build/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Qa0mhq-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/jmathews/.virtualenvs/django/include/site/python2.7 failed with error code 1 in /home/jmathews/.virtualenvs/django/build/MySQL-python
Storing debug log for failure in /home/jmathews/.pip/pip.log
The following packages were installed and updated.
yum install -y gcc gcc-c++ libxml2-devel libxslt-devel
I also ran
yum groupinstall "Development Tools" "Development Libraries"
The problem persists. Is the problem with the package or any missing dependencies?

yum info mysql-devel
If it's not installed, install it
yum install mysql-devel
Now try
sudo pip install mysql-python

You need to install the header files for mysql library.
I don't know for your distrib, on Ubuntu the package name is libmysqlclient-dev.
By the way, if starting a new project, I would recommend PostgreSQL over MySQL, because support for MySQL is uncertain at best.
edit: turns out things change, there are now bindings for Python 3

Installing mysql-dev solved my problem as well. Thanks a lot!

yum install mysql-devel
and then
pip install MySQL-python

Related

pyuci openwrt package installation fails (how to install libuci in first place?)

Following this link to install pyuci
https://pypi.org/project/pyuci/
$ sudo pip install pyuci
Collecting pyuci
Using cached pyuci-0.9.0.tar.gz (33 kB)
Building wheels for collected packages: pyuci
Building wheel for pyuci (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-l1y3wubl/pyuci/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l1y3wubl/pyuci/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().re
place('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-usoi27u_
cwd: /tmp/pip-install-l1y3wubl/pyuci/
Complete output (18 lines):
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/euci
copying euci/__init__.py -> build/lib.linux-x86_64-3.8/euci
copying euci/boolean.py -> build/lib.linux-x86_64-3.8/euci
running build_ext
building 'uci' extension
creating build/temp.linux-x86_64-3.8
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 -I/usr/include/python3.8 -c ucimodule.c -o build/temp.linux-x86_64-3.8/ucimodule.o
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 -I/usr/include/python3.8 -c pyuci.c -o build/temp.linux-x86_64-3.8/pyuci.o
pyuci.c:20:10: fatal error: uci.h: No such file or directory
20 | #include <uci.h>
| ^~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyuci
Running setup.py clean for pyuci
Failed to build pyuci
Installing collected packages: pyuci
Running setup.py install for pyuci ... error
Although I see libuci as one of the requirements in the link I am not sure how to install libuci itself
Appreciate any suggestions and help
My dev environment:
Ubuntu 20.04.3 LTS
Python 3.8.10
Thanks in advance

Dependencies issue building a Dockerfile

I have been trying to build a Dockerfile from github but when i build it i got the following errors:
Building wheels for collected packages: subprocess32, sqlalchemy, scandir
Building wheel for subprocess32 (setup.py): started
Building wheel for subprocess32 (setup.py): finished with status 'done'
Created wheel for subprocess32: filename=subprocess32-3.5.4-cp27-cp27mu-linux_x86_64.whl size=47608 sha256=fe35748bdc27c9d9c269fb1d612dd73cdfe617d4e2cd8cf80587d828df9bd297
Stored in directory: /root/.cache/pip/wheels/e3/c7/6a/434fc8f2936acc4964ded8478435a8ef7c69eb41df7007a49f
Building wheel for sqlalchemy (setup.py): started
Building wheel for sqlalchemy (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rx01B5/sqlalchemy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rx01B5/sqlalchemy/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-JdSdpB
cwd: /tmp/pip-install-rx01B5/sqlalchemy/
Complete output (547 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/sqlalchemy
copying lib/sqlalchemy/inspection.py -> build/lib.linux-x86_64-2.7/sqlalchemy
.
.
.
.
.
running build_ext
building 'sqlalchemy.cprocessors' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/lib
creating build/temp.linux-x86_64-2.7/lib/sqlalchemy
creating build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/processors.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/processors.o -Wundef -Werror=implicit-function-declaration
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/processors.o -o build/lib.linux-x86_64-2.7/sqlalchemy/cprocessors.so
building 'sqlalchemy.cresultproxy' extension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/resultproxy.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/resultproxy.o -Wundef -Werror=implicit-function-declaration
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/resultproxy.o -o build/lib.linux-x86_64-2.7/sqlalchemy/cresultproxy.so
building 'sqlalchemy.cimmutabledict' extension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/immutabledict.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/immutabledict.o -Wundef -Werror=implicit-function-declaration
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/immutabledict.o -o build/lib.linux-x86_64-2.7/sqlalchemy/cimmutabledict.so
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/sqlalchemy
creating build/bdist.linux-x86_64/wheel/sqlalchemy/engine
copying build/lib.linux-x86_64-2.7/sqlalchemy/engine/interfaces.py -> build/bdist.linux-x86_64/wheel/sqlalchemy/engine
.
.
.
.
.
running install_egg_info
error: 'egg_base' must be a directory name (got `lib`)
----------------------------------------
ERROR: Failed building wheel for sqlalchemy
Running setup.py clean for sqlalchemy
Building wheel for scandir (setup.py): started
Building wheel for scandir (setup.py): finished with status 'done'
Created wheel for scandir: filename=scandir-1.10.0-cp27-cp27mu-linux_x86_64.whl size=40684 sha256=0ebd2cf5afe24d5a60d5cd5a6f62ead402fc8c29c3dd71abcdf1e4378ebc427c
Stored in directory: /root/.cache/pip/wheels/58/2c/26/52406f7d1f19bcc47a6fbd1037a5f293492f5cf1d58c539edb
Successfully built subprocess32 scandir
Failed to build sqlalchemy
Installing collected packages: subprocess32, lockfile, scandir, pathlib2, contextlib2, zipp, configparser, importlib-metadata, sqlalchemy
Running setup.py install for sqlalchemy: started
Running setup.py install for sqlalchemy: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rx01B5/sqlalchemy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rx01B5/sqlalchemy/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-ZJroJ3/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python2.7/sqlalchemy
cwd: /tmp/pip-install-rx01B5/sqlalchemy/
Complete output (841 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/sqlalchemy
copying lib/sqlalchemy/inspection.py -> build/lib.linux-x86_64-2.7/sqlalchemy
.
.
.
.
running build_ext
building 'sqlalchemy.cprocessors' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/lib
creating build/temp.linux-x86_64-2.7/lib/sqlalchemy
creating build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/processors.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/processors.o -Wundef -Werror=implicit-function-declaration
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/processors.o -o build/lib.linux-x86_64-2.7/sqlalchemy/cprocessors.so
building 'sqlalchemy.cresultproxy' extension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/resultproxy.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/resultproxy.o -Wundef -Werror=implicit-function-declaration
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/resultproxy.o -o build/lib.linux-x86_64-2.7/sqlalchemy/cresultproxy.so
building 'sqlalchemy.cimmutabledict' extension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/immutabledict.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/immutabledict.o -Wundef -Werror=implicit-function-declaration
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2KjtLn/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/immutabledict.o -o build/lib.linux-x86_64-2.7/sqlalchemy/cimmutabledict.so
running install_lib
creating /usr/local/lib/python2.7/dist-packages/sqlalchemy
creating /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine
copying build/lib.linux-x86_64-2.7/sqlalchemy/engine/interfaces.py -> /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine
.
.
.
copying build/lib.linux-x86_64-2.7/sqlalchemy/schema.py -> /usr/local/lib/python2.7/dist-packages/sqlalchemy
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/interfaces.py to interfaces.pyc
.
.
.
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/postgresql/asyncpg.py to asyncpg.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 372
async def _prepare_and_execute(self, operation, parameters):
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/mysql/aiomysql.py to aiomysql.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/mysql/aiomysql.py", line 102
async def _execute_async(self, operation, parameters):
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/util/_concurrency_py3k.py to _concurrency_py3k.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 46
def await_only(awaitable: Coroutine) -> Any:
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/plugin.py to plugin.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/plugin.py", line 46
self, fullname: str
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/apply.py to apply.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/apply.py", line 41
cls: ClassDef,
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/infer.py to infer.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/infer.py", line 39
api: SemanticAnalyzerPluginInterface,
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/util.py to util.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/util.py", line 41
is_mapped: bool,
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/decl_class.py to decl_class.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/decl_class.py", line 46
cls: ClassDef,
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/names.py to names.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mypy/names.py", line 31
COLUMN: int = util.symbol("COLUMN") # type: ignore
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/mutable.py to mutable.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/serializer.py to serializer.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/hybrid.py to hybrid.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/engine.py to engine.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/engine.py", line 98
async def start(self, is_ctxmanager=False):
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/events.py to events.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/base.py to base.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/base.py", line 50
async def start(self, is_ctxmanager=False):
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/exc.py to exc.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/session.py to session.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/session.py", line 83
async def refresh(
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/result.py to result.pyc
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/asyncio/result.py", line 18
async def close(self):
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/indexable.py to indexable.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/instrumentation.py to instrumentation.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/sqlalchemy/schema.py to schema.pyc
running install_egg_info
error: 'egg_base' must be a directory name (got `lib`)
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rx01B5/sqlalchemy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rx01B5/sqlalchemy/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-ZJroJ3/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python2.7/sqlalchemy Check the logs for full command output.
The command '/bin/sh -c pip install subprocess32 lockfile sqlalchemy -i https://pypi.python.org/simple' returned a non-zero code: 1
So i tried to install manually the following dependencies that are linked to a file on the github repository:
SQLAlchemy==1.0.14
zmq==0.0.0
pyzmq==15.2.0
psycopg2==2.6.1
lockfile==0.10.2
tabulate==0.7.5
pexpect==3.2
psutil==5.6.6
ipython==2.3.0
colorama==0.3.2
numpy==1.8.2
argparse==1.2.1
subprocess32==3.2.6
But running the command $pip install psycopg2==2.6.1 i got:
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. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting psycopg2==2.6.1
Using cached psycopg2-2.6.1.tar.gz (371 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-S6dRnw/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-S6dRnw/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-Mqd4AD
cwd: /tmp/pip-install-S6dRnw/psycopg2/
Complete output (7 lines):
running egg_info
creating /tmp/pip-pip-egg-info-Mqd4AD/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-Mqd4AD/psycopg2.egg-info/PKG-INFO
writing top-level names to /tmp/pip-pip-egg-info-Mqd4AD/psycopg2.egg-info/top_level.txt
writing dependency_links to /tmp/pip-pip-egg-info-Mqd4AD/psycopg2.egg-info/dependency_links.txt
writing manifest file '/tmp/pip-pip-egg-info-Mqd4AD/psycopg2.egg-info/SOURCES.txt'
Error: could not determine PostgreSQL version from '12.7'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It seems the psycopg2 complains about inability to determine PostgreSQL version.
Looking at this https://github.com/psycopg/psycopg2/issues/594
The problem was fixed in #489 released in psycopg 2.7. We don't have plans to backport the fix to 2.6.
Use a pg_config from a production version of Postgres not from 10 beta
4
I was wondering whether i can fix it or there is no way to do it.
Furthermore i installed the latest version of the psycopg package and built the docker again but i always get the same issue mentioned above.
Thank you.

I am trying to install pywinpty, But Getting below error

Getting below error while installing pywinpty
Collecting
https://files.pythonhosted.org/packages/b0/2c/11676105f51a7718316cd74186630f4a4cb0efa3530ebf3cfbe0b72e35cb/pywinpty-1.0.1.tar.gz
Using cached
https://files.pythonhosted.org/packages/b0/2c/11676105f51a7718316cd74186630f4a4cb0efa3530ebf3cfbe0b72e35cb/pywinpty-1.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-ScCf1b-build/setup.py'
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-ScCf1b-build/
Now i am getting below error while installing using the command pip install pywinpty==0.5.7
Collecting pywinpty==0.5.7
Using cached https://files.pythonhosted.org/packages/5d/97/8e43c2152a638cdb83d45644eb125c752abe67249f94bb3e3e29b0709685/pywinpty-0.5.7.tar.gz
Requirement already satisfied: backports.shutil_which; python_version < "3.0" in /opt/virtualenvs/certerminal/lib/python2.7/site-packages (from pywinpty==0.5.7)
Building wheels for collected packages: pywinpty
Running setup.py bdist_wheel for pywinpty ... error
Complete output from command /opt/virtualenvs/certerminal/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-CI2oGR/pywinpty/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/tmpYI7Uslpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/winpty
copying winpty/__init__.py -> build/lib.linux-x86_64-2.7/winpty
copying winpty/ptyprocess.py -> build/lib.linux-x86_64-2.7/winpty
copying winpty/winpty_wrapper.py -> build/lib.linux-x86_64-2.7/winpty
creating build/lib.linux-x86_64-2.7/winpty/_winpty
copying winpty/_winpty/__init__.py -> build/lib.linux-x86_64-2.7/winpty/_winpty
creating build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/__init__.py -> build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/test_cywinpty.py -> build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/test_ptyprocess.py -> build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/test_winpty_wrapper.py -> build/lib.linux-x86_64-2.7/winpty/tests
running build_ext
building 'winpty.cywinpty' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/winpty
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c winpty/cywinpty.c -o build/temp.linux-x86_64-2.7/winpty/cywinpty.o
winpty/cywinpty.c:628:21: fatal error: Windows.h: No such file or directory
#include "Windows.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pywinpty
Running setup.py clean for pywinpty
Failed to build pywinpty
Installing collected packages: pywinpty
Running setup.py install for pywinpty ... error
Complete output from command /opt/virtualenvs/certerminal/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-CI2oGR/pywinpty/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-n18o4q-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/virtualenvs/certerminal/include/site/python2.7/pywinpty:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/winpty
copying winpty/__init__.py -> build/lib.linux-x86_64-2.7/winpty
copying winpty/ptyprocess.py -> build/lib.linux-x86_64-2.7/winpty
copying winpty/winpty_wrapper.py -> build/lib.linux-x86_64-2.7/winpty
creating build/lib.linux-x86_64-2.7/winpty/_winpty
copying winpty/_winpty/__init__.py -> build/lib.linux-x86_64-2.7/winpty/_winpty
creating build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/__init__.py -> build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/test_cywinpty.py -> build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/test_ptyprocess.py -> build/lib.linux-x86_64-2.7/winpty/tests
copying winpty/tests/test_winpty_wrapper.py -> build/lib.linux-x86_64-2.7/winpty/tests
running build_ext
building 'winpty.cywinpty' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/winpty
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c winpty/cywinpty.c -o build/temp.linux-x86_64-2.7/winpty/cywinpty.o
winpty/cywinpty.c:628:21: fatal error: Windows.h: No such file or directory
#include "Windows.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/opt/virtualenvs/certerminal/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-CI2oGR/pywinpty/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-n18o4q-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/virtualenvs/certerminal/include/site/python2.7/pywinpty" failed with error code 1 in /tmp/pip-build-CI2oGR/pywinpty/

Why it is showing error while installing mysqlclient?

I am trying to install mysqlclient using pip install mysqlclient but it's showing the following error:
pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-haimRr/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 /tmp/tmpnpNImepip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c: In function ‘_mysql_field_to_python’:
MySQLdb/_mysql.c:1145:33: warning: passing argument 1 of ‘PyInt_FromString’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
return PyInt_FromString(rowitem, NULL, 10);
^~~~~~~
In file included from /usr/include/python2.7/Python.h:89:0,
from MySQLdb/_mysql.c:38:
/usr/include/python2.7/intobject.h:37:24: note: expected ‘char *’ but argument is of type ‘const char *’
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
^~~~~~~~~~~~~~~~
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/MySQLdb/_mysql.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
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
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-haimRr/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 /tmp/pip-Z3t7oY-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c: In function ‘_mysql_field_to_python’:
MySQLdb/_mysql.c:1145:33: warning: passing argument 1 of ‘PyInt_FromString’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
return PyInt_FromString(rowitem, NULL, 10);
^~~~~~~
In file included from /usr/include/python2.7/Python.h:89:0,
from MySQLdb/_mysql.c:38:
/usr/include/python2.7/intobject.h:37:24: note: expected ‘char *’ but argument is of type ‘const char *’
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
^~~~~~~~~~~~~~~~
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/MySQLdb/_mysql.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-haimRr/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 /tmp/pip-Z3t7oY-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-haimRr/mysqlclient/
How can I fix this error ?
The error is saying that you miss lssl and lcrypto.
To solve you need to install libssl-dev.

Installing cx_Freeze on Ubuntu returns error code 1 [duplicate]

I am trying to create a binary from a python,flask and boto3 app. I am having trouble running the pip install cx_Freeze command too work. I am getting the following error :
It seems to be not fetching the right system libraries. Also, can anyone suggest any tools to package python apps into binaries?
Failed building wheel for cx-Freeze
Running setup.py clean for cx-Freeze
Failed to build cx-Freeze
Installing collected packages: cx-Freeze
Running setup.py install for cx-Freeze ... error
Complete output from command /home/shaswat.g/.virtualenvs/flask_app/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yLvkz9/cx-Freeze/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-kKRaSM-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/shaswat.g/.virtualenvs/flask_app/include/site/python2.7/cx-Freeze:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/dist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/main.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/common.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/__init__.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/macdist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/finder.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/setupwriter.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/windist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/hooks.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/freezer.py -> build/lib.linux-x86_64-2.7/cx_Freeze
creating build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLibSource.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/__startup__.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLib.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/ConsoleSetLibPath.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/Console.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
copying cx_Freeze/samples/relimport/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
copying cx_Freeze/samples/relimport/relimport.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/Config.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/ServiceHandler.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
copying cx_Freeze/samples/openpyxl/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
copying cx_Freeze/samples/openpyxl/test_openpyxl.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
copying cx_Freeze/samples/simple/hello.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
copying cx_Freeze/samples/simple/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
copying cx_Freeze/samples/matplotlib/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
copying cx_Freeze/samples/matplotlib/matplotlib_eg.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/ matplotlib
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
copying cx_Freeze/samples/PyQt4/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
copying cx_Freeze/samples/PyQt4/PyQt4app.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/advanced_1.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/advanced_2.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
copying cx_Freeze/samples/asmodule/asmodule.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
copying cx_Freeze/samples/asmodule/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
copying cx_Freeze/samples/zope/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
copying cx_Freeze/samples/zope/qotd.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
copying cx_Freeze/samples/Tkinter/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
copying cx_Freeze/samples/Tkinter/SimpleTkApp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
copying cx_Freeze/samples/wx/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
copying cx_Freeze/samples/wx/wxapp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
running build_ext
building 'cx_Freeze.util' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/source
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/util.c -o build/temp.linux-x86_64-2.7/source/util.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/ python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/source/util.o -o build/ lib.linux-x86_64-2.7/cx_Freeze/util.so
creating build/temp.linux-x86_64-2.7/source/bases
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/bases/ Console.c -o build/temp.linux-x86_64-2.7/source/bases/Console.o
creating build/lib.linux-x86_64-2.7/cx_Freeze/bases
x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/source/bases/Console.o -L/usr/lib/python2.7/ config-x86_64-linux-gnu -lpython2.7 -o build/lib.linux-x86_64-2.7/cx_Freeze/bases/Console -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lpthread -ldl -lutil -lm -L/usr/lib -lz -s
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/shaswat.g/.virtualenvs/flask_app/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yLvkz9/cx-Freeze/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-kKRaSM-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/shaswat.g/.virtualenvs/flask_app/include/site/python2.7/cx-Freeze" failed with error code 1 in /tmp/pip-build-yLvkz9/cx-Freeze/
Just do
sudo apt install zlib1g-dev
I was trying to install cx-freeze to convert some python code to an exe but the problem was /usr/bin/ld: cannot find -lz just like you. The file being fetched is compressed (cx_Freeze-5.1.1.tar.gz) so you need zlib. Of course use pip3 for python3.
pip never installs system libraries, it only concerns itself with Python libs.
It seems you need to install zlib before installing cx_Freeze.
Another tool to generate binaries is PyInstaller.
This solution works for me on centos8
yum install gcc
yum install python3-devel
pip install wheel
pip install importlib-metadata
pip install patchelf
pip3 install cx-Freeze

Categories