Failed to build the bsdiff module - python

Good afternoon all,
I am having trouble using the bsdiff module with Python. While I can use shell scripts I would prefer to have a cross-platform solution.
I have downloaded bsdiff4-1.1.4 and attempt to run setup.py as follows:
Files list:
bsdiff4 build CHANGELOG.txt do.sh examples Makefile README.rst setup.py
I run:
python3 setup.py build
And I get this error:
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'entry_points'
warnings.warn(msg)
running build
running build_py
running build_ext
building 'bsdiff4.core' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c bsdiff4/core.c -o build/temp.linux-x86_64-3.4/bsdiff4/core.o
bsdiff4/core.c:8:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I want to be able to use python to apply patches to binary files.
Any help appreciated.
José

You need to install apt-get install python3-dev.
ubuntu python3-dev
header files and a static library for Python
If it is your system python you will need sudo

Related

Python.h not found even after I used sudo install

I've been studying darkflow from the following link;
https://github.com/thtrieu/darkflow
on Ubuntu 20.04
I thought there was a problem in my flow file, so I tried to rebuild the build file by the following code
dyi#D-FIP7VAE:~/Tiny-YOLO-voc-traffic-sign-detection$ python3.7 setup.py build_ext --inplace<br/>
and this is what i got.
setup.py:6: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
running build_ext
building 'darkflow.cython_utils.nms' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.7-ZE4Yn0/python3.7-3.7.10=. -fstack-protector-strong -Wformat -Werror=format-security -g -fdebug-prefix-map=/build/python3.7-ZE4Yn0/python3.7-3.7.10=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/dyi/.local/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c darkflow/cython_utils/nms.c -o build/temp.linux-x86_64-3.7/darkflow/cython_utils/nms.o
darkflow/cython_utils/nms.c:29:10: fatal error: Python.h: No such file or directory
29 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
so I tried this
sudo apt-get install python3-dev
But this didn't work, and I get the same error over and over.
Can anybody find the reason why..?
You can try :
sudo apt install libpython3.7-dev

trouble install mysqlclient on ubuntu18.04

I am trying to install mysqlclient on ubuntu 18.04 for a Django project but having problem installing mysql. Here is the information from the terminal:
pip install mysqlclient
Collecting mysqlclient
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
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/opt/lampp/include/mysql -I/opt/lampp/include/mysql/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c:29:10: fatal error: mysql.h: No such file or directory`enter code here`
#include "mysql.h"
^~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
You'll have to install the MySQL headers.
sudo apt install libmysqlclient-dev
(and stop using Python 2.7, it's out of support in a month)

Error when compiling biopython1.65: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I am trying to install biopython 1.65 in debian. I have the dependencies Numpy and Scipy.
When I try to build it, it fails:
python setup.py build
running build
running build_py
running build_ext
building 'Bio.cpairwise2' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c Bio/cpairwise2module.c -o build/temp.linux-x86_64-2.7/Bio/cpairwise2module.o
Bio/cpairwise2module.c:12:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Somebody know how I can solve it?
Many thanks
#include "Python.h"
tells the preprocessor to search a local file, and if it doesn't exists there, the preprocessor changes it to
#include <Python.h>
which should be located in /usr/include/python2.7 (which is passed as argument to gcc). Many Linux distros don't have header files installed by default, so you have to install it manually.
Header files for python2.7 are shipped with package libpython2.7-dev
You can find which package to install by searching it with aptitude, synaptic or apt-cache search adding dev after the package name (in that case python dev); the name could be different than the installed one.
Had the same issue on Fedora, what helped was:
yum install python-devel

Building pywt on ubuntu

I have problems building pywt from source on Ubuntu.
When I run python setup.py build, I get the following error:
running build
running build_py
running build_ext
Cython is not installed. Using compiled file: src/_pywt.pyx
building 'pywt._pywt' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPY_EXTENSION -Isrc -I/usr/local/include/python2.7 -c src/_pywt.c -o build/temp.linux-x86_64-2.7/src/_pywt.o
gcc: error: src/_pywt.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: command 'gcc' failed with exit status 4
When I run cython --version I get the following output:
Cython version 0.21.1
pywt can be installed as an Ubuntu package using apt-get:
sudo apt-get install python-pywt

Installing rdiff on docker containers

I am trying to make a backup solution off docker containers using rdiff. I have python install and the python-dev packages but when I run the install command:
python ./setup.py install
I get the following error
running install
running build
running build_py
running build_ext
building 'rdiff_backup._librsync' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c _librsyncmodule.c -o build/temp.linux-x86_64-2.7/_librsyncmodule.o
_librsyncmodule.c:25:22: fatal error: librsync.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Your container needs the librsync-dev package.

Categories

Resources