I am trying to build pynauty according to this instructions:
https://web.cs.dal.ca/~peter/software/pynauty/html/install.html#build
I would like point out that my main goal is to run this python code:
https://github.com/calebh/dihash
Sadly I can not pass the pynauty's make phase.
If I execute make pynauty command I get the following error:
cd nauty; make nauty.o nautil.o naugraph.o schreier.o naurng.o
make[1]: Entering directory '/home/pc/pynauty-0.6.0/nauty27rc5'
make[1]: 'nauty.o' is up to date.
make[1]: 'nautil.o' is up to date.
make[1]: 'naugraph.o' is up to date.
make[1]: 'schreier.o' is up to date.
make[1]: 'naurng.o' is up to date.
make[1]: Leaving directory '/home/pc/pynauty-0.6.0/nauty27rc5'
python setup.py build
running build
running build_py
running build_ext
building 'pynauty.nautywrap' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-8kFkPd/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Inauty -Isrc -I/usr/include/python2.7 -c src/nautywrap.c -o build/temp.linux-x86_64-2.7/src/nautywrap.o -O4 -fPIC
src/nautywrap.c:15:10: fatal error: Python.h: No such file or directory
15 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [Makefile:36: pynauty] Error 1
I guess the above is because I don't have python-dev package installed (I want to build if for python3). So I've added an alias for python3 with:
aliast python=python3.
But still when I type make in the pynauty's root directory I get a message saying that python2 is detected:
Available targets:
pynauty - build the pynauty extension module
tests - run all tests
clean - remove all python related temp files and dirs
user-ins - install pynauty into ~/.local/
user-unins - uninstall pynauty from ~/.local/
virtenv-ins - install pynauty into the active virtualenv
virtenv-unins - uninstall pynauty from the active virtualenv
dist - create a source distribution
docs - build pyanauty documentation
clean-docs - remove pyanauty documentation
nauty-objects - compile only nauty.o nautil.o naugraph.o schreier.o naurng.o
nauty-progs - build all nauty programs
clean-nauty - a "distclean" for nauty
clobber - clean + clean-nauty + clean-docs
Python version: 2 7 17
Machine type: x86_64
Edit the Makefile for nauty.
Change PYTHON = python to PYTHON = python3, and
PIP = pip to PIP = pip3 (or whatever your pip for Python 3 is called).
Related
I built Python 3.6 from source and am trying to install lxml. Trying to install it from pip gives the following error:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/local/include/python3.6m -c src/lxml/etree.c -o build/temp.linux-armv6l-3.6/src/lxml/etree.o -w
src/lxml/etree.c:91:20: fatal error: Python.h: No such file or directory
compilation terminated.
Compile failed: command 'gcc' failed with exit status 1
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitln68cjsn.c -o tmp/xmlXPathInitln68cjsn.o
cc tmp/xmlXPathInitln68cjsn.o -L/usr/lib -lxml2 -o a.out
error: command 'gcc' failed with exit status 1
The same error is raised if I try to install Cython to compile lxml from source. I installed libxml2-dev and libxslt1-dev, but python3.6-dev, which is apparently also required, is not found in Raspbian repository. I added the following line to /etc/apt/sources.list:
deb http://ftp.de.debian.org/debian sid main
But when trying to install it afterwards, I receive the following error:
The following packages have unmet dependencies:
libdbus-1-3 : Breaks: dbus (< 1.9.16-1~) but 1.6.8-1+deb7u1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
In fact, this error is raised on any package that is found in Debian repository that is not in Raspbian one. What can I do about this?
Since you installed Python from source, you should have the header files already. Should also use header files for the version that you built as opposed to the version in the package manager.
Either
Add the source code directory to includes used by GCC (gcc -I<dir>) or
Install the from source package in a system directory that is automatically included like /usr/include or /usr/local/include
The second option is probably easiest and should be possible from the standard configure/make scripts.
I am trying to build the project from: https://github.com/TNG/boost-python-examples which is a set of boost python examples on Yosemite.
First I installed Boost and Boost python and cmake
brew install boost
brew install boost-pyton
brew install cmake
I've run into the following error:
/usr/local/Cellar/cmake/3.0.2/bin/cmake -H/Users/demo/devel/boost-python-examples -B/Users/demo/devel/boost-python-examples/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.0.2/bin/cmake -E cmake_progress_start /Users/demo/devel/boost-python-examples/build/CMakeFiles /Users/demo/devel/boost-python-examples/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f 01-HelloWorld/CMakeFiles/hello.dir/build.make 01-HelloWorld/CMakeFiles/hello.dir/depend
cd /Users/demo/devel/boost-python-examples/build && /usr/local/Cellar/cmake/3.0.2/bin/cmake -E cmake_depends "Unix Makefiles" /Users/demo/devel/boost-python-examples /Users/demo/devel/boost-python-examples/01-HelloWorld /Users/demo/devel/boost-python-examples/build /Users/demo/devel/boost-python-examples/build/01-HelloWorld /Users/demo/devel/boost-python-examples/build/01-HelloWorld/CMakeFiles/hello.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f 01-HelloWorld/CMakeFiles/hello.dir/build.make 01-HelloWorld/CMakeFiles/hello.dir/build
Linking CXX shared module hello.so
cd /Users/demo/devel/boost-python-examples/build/01-HelloWorld && /usr/local/Cellar/cmake/3.0.2/bin/cmake -E cmake_link_script CMakeFiles/hello.dir/link.txt --verbose=1
/usr/bin/c++ -g -bundle -Wl,-headerpad_max_install_names -o hello.so CMakeFiles/hello.dir/hello.cpp.o /usr/local/lib/libboost_python-mt.dylib
Undefined symbols for architecture x86_64:
"_PyString_Type", referenced from:
boost::python::to_python_value<char const* const&>::get_pytype() const in hello.cpp.o
"__Py_NoneStruct", referenced from:
boost::python::api::object::object() in hello.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [01-HelloWorld/hello.so] Error 1
make[1]: *** [01-HelloWorld/CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2
It looks like its calling:
/usr/bin/c++ -stdlib=libstdc++ -g -bundle -Wl,-headerpad_max_install_names -o hello.so CMakeFiles/hello.dir/hello.cpp.o /usr/local/lib/libboost_python-mt.dylib
I've tried the following:
Removing the -stdlib=libstdc++
Using gcc instead of c++
Using -m32 (bad idea)
As far as i can tell the dynlib is good:
/usr/local/lib/libboost_python-mt.dylib: Mach-O 64-bit dynamically linked shared library x86_64
So I'm not sure where my issue currently is. I'm assuming its some sort of build flag i'm missing here.
Thanks!
You also need to link in the Python library.
In your CMakeLists.txt you can add
include(FindPythonLibs)
This will define a variable PYTHON_LIBRARIES which you can then use like this
target_link_libraries(your_exe ${PYTHON_LIBRARIES ...)
Try to force cmake to use the right directories:
cmake -DBOOST_ROOT=xxx -DPYTHON_LIBRARY=xxx -DPYTHON_INCLUDE_DIR=xxx ..
I am trying to install the python package biopython from source on my Macbook pro OSX 10.9.4,
I run python setup.py build in the terminal and receive this
running build
running build_py
running build_ext
building 'Bio.cpairwise2' extension
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
gcc -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -Qunused-arguments -Qunused-arguments -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c Bio/cpairwise2module.c -o build/temp.macosx-10.6-x86_64-2.7/Bio/cpairwise2module.o
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
In file included from Bio/cpairwise2module.c:12:
/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx- x86_64/Canopy.app/Contents/include/python2.7/Python.h:33:10: fatal error:
'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
error: command 'gcc' failed with exit status 1
I checked that Xcode should be properly installed and working
You should be using pip. Try:
pip install biopython
Uninstalled Canopy and everything worked like a charm...
Try installing the Biopython version available from the Canopy "Package Manager" > "Available Packages" > "Canopy Packages".
This way, I seem to have solved a similar problem while installing Pyensembl, that also installs Biopython.
I'm trying to install PyQt5 on my Ubuntu 12.04 box. So after downloading it from here I untarred it, ran python configure.py and make. Make however, results in the following:
cd qpy/ && ( test -f Makefile || /opt/qt5/bin/qmake /home/kram/Downloads/PyQt-gpl-5.0/qpy/qpy.pro -o Makefile ) && make -f Makefile
make[1]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy' is entered
cd QtCore/ && ( test -f Makefile || /opt/qt5/bin/qmake /home/kram/Downloads/PyQt-gpl-5.0/qpy/QtCore/QtCore.pro -o Makefile ) && make -f Makefile
make[2]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy/QtCore' is entered
g++ -c -pipe -fno-strict-aliasing -O2 -Wall -W -fPIC -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I/opt/qt5/mkspecs/linux-g++ -I. -I. -I../../QtCore -I/usr/local/include/python2.7 -I/opt/qt5/include -I/opt/qt5/include/QtCore -I. -o qpycore_chimera.o qpycore_chimera.cpp
qpycore_chimera.cpp:21:20: fatal error: Python.h: File or folder does not exist
compilation terminated.
make[2]: *** [qpycore_chimera.o] Error 1
make[2]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy/QtCore' is left
make[1]: *** [sub-QtCore-make_first] Error 2
make[1]: Map '/home/kram/Downloads/PyQt-gpl-5.0/qpy' is left
make: *** [sub-qpy-make_first-ordered] Error 2
(I translated some parts of the error message from Dutch to English, so some words may be a bit off from the normal wording..)
Does anybody what the problem is here? Where could the relevant Python.h file be?
The problem is that the include path for all python headers in every Makefile will be pointing to /usr/local/include/python2.7 , which should have been /usr/include/python2.7
There are 2 possible solutions for this. Either you can change all the occurrence of this in every Makefile or else you can create a symlink to that location
sudo ln -s /usr/include/python2.7 /usr/local/include/python2.7
Now you can run make
sudo apt-get install python-dev
Your missing the python header files.
The problem you're having is that PyQt assumes you're not using your distro's managed python, and instead defaults to looking for sip in /usr/local/include/python2.7.
Luckily, configure.py provides options to override the python and sip include locations:
python configure.py --sip-incdir /usr/include/python2.7 py_inc_dir=/usr/include/python2.7
This solution should preferred to symlinking /usr/include/python2.7 into /usr/local/include/python2.7 as that will enable manually installed software to pollute (or corrupt packages installed to) distro-managed paths.
It is better to add existing header files to the project directory in both QTCreator and Anjuta IDE.
I'm trying to install lxml, on an Ubuntu server running Python 2.6 (in a virtualenv - the system Python is 2.5).
I've checked out via svn and as a result I've also install Cython, as per the instructions.
However, I get the following error when running python setup.py build:
Building lxml version 2.3.alpha1-76211.
Building with Cython 0.11.
Using build configuration of libxslt 1.1.22
Building against libxml2/libxslt in the following directory: /usr/lib
running build
running build_py
running build_ext
cythoning src/lxml/lxml.etree.pyx to src/lxml/lxml.etree.c
Error converting Pyrex file to C:
------------------------------------------------------------
...
c_child = _findChildForwards(c_node, 0)
while c_child is not NULL:
if c_child.type == tree.XML_ELEMENT_NODE:
for i in range(c_tag_count):
if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
^
------------------------------------------------------------
/home/admin/web/blink/lxml/src/lxml/cleanup.pxi:246:64: Cannot assign type 'int' to 'xmlNode *'
Error converting Pyrex file to C:
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/python/2.6.5/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1
And very similar errors if i try python setup.py bdist_egg, python setup.py build_ext -i or make
Trying to install via easy_install or pip produces the same error - although the former just hangs indefinitely.
As far as I am aware, all of the various dependencies, such as python-dev are installed.
What am I missing / doing wrong?
"I've checked out via svn" ...
"Building lxml version 2.3.alpha1-76211" ...
You appear to be on the bleeding edge. Suggestions: Use a released version of the lxml source. Consult with the lxml author/maintainer.