Error with PyML build - python

I'm looking to start a Machine Learning project, and I attempted to install PyML (on Mac OS X 10.6.8). In doing so I received the following error while running python setup.py build.
PyML/containers/ext/SparseDataSet_wrap.cpp: At global scope:
PyML/containers/ext/SparseDataSet_wrap.cpp:17658: fatal error: error writing to -: Broken pipe
compilation terminated.
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
PyML/containers/ext/SparseDataSet_wrap.cpp: In static member function ‘static Type swig::traits_as<Type, swig::value_category>::as(PyObject*, bool) [with Type = float]’:
PyML/containers/ext/SparseDataSet_wrap.cpp:3341: warning: ‘v’ may be used uninitialized in this function
PyML/containers/ext/SparseDataSet_wrap.cpp: In static member function ‘static Type swig::traits_as<Type, swig::value_category>::as(PyObject*, bool) [with Type = int]’:
PyML/containers/ext/SparseDataSet_wrap.cpp:3341: warning: ‘v’ may be used uninitialized in this function
lipo: can't open input file: /var/folders/BB/BB-0UcDKHzKgl2HboGzXqU+++TI/-Tmp-//ccf93ouC.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
I followed the following tutorial for the install process:
http://pyml.sourceforge.net/tutorial.html
Any suggestions on what might be causing it and how to fix it? Thanks.

I also had precisely the same problem using PyML on Ubuntu.
Installing the Python development package (python2.x-dev) resolved the issue. You need to install those Python development headers, installing XCode should also install the headers on Mac.
They are usually located in "/System/Library/Frameworks/Python.framework/Versions/2.6/"

Related

Issues installing a python wrapper for a C program on Linux Subsystem for Windows

I am trying to use a new bioinformatics program written in C named 'Giggle'. They have included a python wrapper. Since I am on Windows 10 most of the bioinformatics stuff is only available for Linux, I am using the Linux subssystem with python 2 installed. The installation for the wrapper are as follows:
git clone --recursive https://github.com/brentp/python-giggle
cd python-giggle
python setup.py test
python setup.py install
When running the setup.py test I encountered all sorts of dependencies of which I had never heard like libbz2 and liblzma. Installation of these dependencies worked fine with sudo apt-get install but now upon running the test I get a long list of warnings like this one:
lib/htslib/hfile_libcurl.c:187:13: warning: function declaration isn’t a
prototype [-Wstrict-prototypes]
static void libcurl_exit()
These are all for different .h and .c files. The list ends with several errors:
lib/htslib/hfile_s3.c:70:2: error: #error No HMAC() routine found by configure
#error No HMAC() routine found by configure
^
lib/htslib/hfile_s3.c: In function ‘s3_rewrite’:
lib/htslib/hfile_s3.c:335:30: error: ‘DIGEST_BUFSIZ’ undeclared (first use in this function)
unsigned char digest[DIGEST_BUFSIZ];
^
lib/htslib/hfile_s3.c:335:30: note: each undeclared identifier is reported only once for each function it appears in
lib/htslib/hfile_s3.c:336:29: warning: implicit declaration of function ‘s3_sign’ [-Wimplicit-function-declaration]
size_t digest_len = s3_sign(digest, &secret, &message);
^
lib/htslib/hfile_s3.c:335:23: warning: unused variable ‘digest’ [-Wunused-variable]
unsigned char digest[DIGEST_BUFSIZ];
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I am kind of lost on this and googling the errors has not made me any wiser. I feel like it is a 'you are still using windows' kind of problem. Any help would be much appreciated.

Compilation issue ( cc1: error: unrecognized command line option "-ip" )

I'm having trouble while compiling certain python modules. The setup fails with the following error:
cc1: error: unrecognized command line option "-ip"
error: Setup script exited with error: command 'gcc' failed with exit status 1
I am on a shared system and do not have root access. So, I install the modules using:
easy_install --prefix=$HOME/local <module_dir>
I looked this up on google and SO but have found no concrete solution yet. From what I understand, it has to do something with the compiler settings/configuration.
I would really appreciate if you could guide me through the steps required to resolve this. I have encountered the same issue with several python modules(pygame, crypto, etc) while most others installed without any hiccups.
Thank You!

Installing PDQ on windows

I am trying to install "pretty damn quick", an analysis tool for Layered Queing networks.
However there seems to be a lot wrong with my system, and switching to Linux is not an option.
Here is what i tried to get the PDQ running:
First try: Python
I installed python2.7 and downloaded the PDQ for python distribution (its in the tarball in the python dir) :
C:\pdq\pdq42\python>python setup.py install
running install
running build
running build_ext
building 'pdq' extension
error: Unable to find vcvarsall.bat
This error stems from the fact that i supposedly dont have a C-compiler. Even though typing g++ gives me:
C:\pdq\pdq42\python>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/rtools/gcc-4.6.3/bin/../libexec/gcc/i686-w64-mingw3
3/lto-wrapper.exe
Target: i686-w64-mingw32
...snipped...
This problem is somehow documented? So i tried going over to Perl. It said there that the compiler comes with Strawberry Perl. So I installed that. Dmake gave me a lot of trouble but in the end I managed to install it.
C:\pdq\pdq42\perl5>perl Makefile.PL
Writing Makefile for pdq
C:\pdq\pdq42\perl5>dmake
Skip blib\lib\pdq.pm (unchanged)
...snipped...
g++.exe: error: MVA_Approx.o: No such file or directory
g++.exe: error: MVA_Canon.o: No such file or directory
g++.exe: error: MVA_Solve.o: No such file or directory
g++.exe: error: PDQ_Build.o: No such file or directory
g++.exe: error: PDQ_Exact.o: No such file or directory
g++.exe: error: PDQ_Globals.o: No such file or directory
g++.exe: error: PDQ_Report.o: No such file or directory
g++.exe: error: PDQ_Utils.o: No such file or directory
dmake: Error code 129, while making 'blib\arch\auto\pdq\pdq.dll'
Gives me new errors, that i cannot fix, since i cannot google them.
As the last resort i try out installing R, since this should work according to the documentation.
install.packages("c:\pdq\pdq_6.0-1.tar.gz",repos=NULL,type="source")
Warning: invalid package 'c:/pdq/pdq_6.0-1.tar.gz'
Error: ERROR: no packages specified
Warning messages:
1: running command '"C:/Programme/R/R-3.0.1/bin/i386/R" CMD INSTALL -l "C:\Programme\R\R-3.0.1\library" "c:/pdq/pdq_6.0-1.tar.gz"' had status 1
2: In install.packages("c:\pdq\pdq_6.0-1.tar.gz", repos = NULL, type = "source") :
installation of package ‘c:/pdq/pdq_6.0-1.tar.gz’ had non-zero exit status
However in this case i don't even know where to start debugging this to get it going.
So I am seeking help from SO. My question is:
Where did I go wrong and what can I do to find additional information leading to identify the problem? I would really like to have PDQ installed.

Problem installing Shoutpy + Boost.python on opensolaris

Im trying to install shoutpy on opensolaris 2009.6. It relies on boost.python. i've installed the boost_devel libraries from blastwave and linked /opt/csw/include/boost to /usr/include/boost . But when I try to easy_install shoutpy I get the following output
munderwo#opensolaris-test1:/usr/include$ pfexec easy_install shoutpy
Searching for shoutpy
Reading http://pypi.python.org/simple/shoutpy/
Reading http://dingoskidneys.com/shoutpy/
Best match: shoutpy 1.0.0
Downloading http://dingoskidneys.com/shoutpy/shoutpy-1.0.0.tar.gz
Processing shoutpy-1.0.0.tar.gz
Running shoutpy-1.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-w7XQfv/shoutpy-1.0.0/egg-dist-tmp-k11Dky
In file included from /usr/include/boost/python/object/make_instance.hpp:9,
from /usr/include/boost/python/object/make_ptr_instance.hpp:8,
from /usr/include/boost/python/to_python_indirect.hpp:11,
from /usr/include/boost/python/converter/arg_to_python.hpp:10,
from /usr/include/boost/python/call.hpp:15,
from /usr/include/boost/python/object_core.hpp:12,
from /usr/include/boost/python/args.hpp:25,
from /usr/include/boost/python.hpp:11,
from shoutpy.cc:26:
/usr/include/boost/python/object/instance.hpp:44: error: a casts to a type other than an integral or enumeration type cannot appear in a constant-expression
/usr/include/boost/python/object/instance.hpp:44: error: '->' cannot appear in a constant-expression
/usr/include/boost/python/object/instance.hpp:44: error: `&' cannot appear in a constant-expression
In file included from /usr/include/boost/python/converter/registry.hpp:9,
from /usr/include/boost/python/converter/registered.hpp:8,
from /usr/include/boost/python/object/make_instance.hpp:10,
from /usr/include/boost/python/object/make_ptr_instance.hpp:8,
from /usr/include/boost/python/to_python_indirect.hpp:11,
from /usr/include/boost/python/converter/arg_to_python.hpp:10,
from /usr/include/boost/python/call.hpp:15,
from /usr/include/boost/python/object_core.hpp:12,
from /usr/include/boost/python/args.hpp:25,
from /usr/include/boost/python.hpp:11,
from shoutpy.cc:26:
/usr/include/boost/python/converter/rvalue_from_python_data.hpp:99: error: '->' cannot appear in a constant-expression
/usr/include/boost/python/converter/rvalue_from_python_data.hpp:99: error: `&' cannot appear in a constant-expression
/usr/include/boost/python/converter/rvalue_from_python_data.hpp:99: error: template argument 1 is invalid
/usr/include/boost/python/converter/rvalue_from_python_data.hpp:99: error: `value' is not a member of `<declaration error>'
error: Setup script exited with error: command '/usr/lib/python2.6/pycc' failed with exit status 1
This is using python2.6, opensolaris 2009.06, boost 1.35.
any help would be great!
Cheers
Mark
Edit - this has been cross posted on serverfault as its a bit hard to classify where the problem domain is. https://serverfault.com/questions/88724/problem-with-opensolaris-boost-python-and-shoutpy
Unfortunately I've never tried to compile shoutpy under OpenSolaris and I don't use it these days. Boost.python requires a lot from its C++ compiler. Use easy_install -b build_directory shoutpy so it'll keep the source code after it fails, then check the C++ compiler Python tries to use against those supported by boost.python.
I tried compiling it on my desktop Linux and it still works after I edit setup.py to link against libboost_python-mt instead of libboost_python which doesn't exist in Ubuntu (there are several libboost_python* depending on Python version and so forth).

Why pysqlite does not work properly?

I tried to install pysqlite. Some suspicious things start to appear during the installation. Why I typed:
python setup.py build
I got the following message in the end:
src/module.c:286: error: ‘SQLITE_PRAGMA’ undeclared here (not in a function)
src/module.c:287: error: ‘SQLITE_READ’ undeclared here (not in a function)
src/module.c:288: error: ‘SQLITE_SELECT’ undeclared here (not in a function)
src/module.c:289: error: ‘SQLITE_TRANSACTION’ undeclared here (not in a function)
src/module.c:290: error: ‘SQLITE_UPDATE’ undeclared here (not in a function)
src/module.c:291: error: ‘SQLITE_ATTACH’ undeclared here (not in a function)
src/module.c:292: error: ‘SQLITE_DETACH’ undeclared here (not in a function)
src/module.c: In function ‘init_sqlite’:
src/module.c:419: warning: implicit declaration of function ‘sqlite3_libversion’
src/module.c:419: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
I just ignored the last line and decided to continue. So, I typed:
python setup.py install
And than, again, I got similar error message:
src/module.c:288: error: ‘SQLITE_SELECT’ undeclared here (not in a function)
src/module.c:289: error: ‘SQLITE_TRANSACTION’ undeclared here (not in a function)
src/module.c:290: error: ‘SQLITE_UPDATE’ undeclared here (not in a function)
src/module.c:291: error: ‘SQLITE_ATTACH’ undeclared here (not in a function)
src/module.c:292: error: ‘SQLITE_DETACH’ undeclared here (not in a function)
src/module.c: In function ‘init_sqlite’:
src/module.c:419: warning: implicit declaration of function ‘sqlite3_libversion’
src/module.c:419: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
After that I wanted to try if pysqlite works.
If in the python-command-line mode I type
from pysqlite2 import *
Python does not complain. However, if I try to follow an exmaple in my book:
from pysqlite2 import dbapi2 as sqlite
I get a error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pysqlite2/dbapi2.py", line 27, in <module>
from pysqlite2._sqlite import *
ImportError: No module named _sqlite
Does anybody have any ideas why it happens and how this problem can be solved. By the way, I have installed a new version of Python. "python -V" gives me "Python 2.6.2". Thank you in advance for any help.
I just ignored the last line and decided to continue.
You can't just ignore the last line. It was telling you there was an error, so it couldn't compile. The next thing you ran told you it couldn't install because it couldn't compile. Then, your python told you it couldn't run the code because it wasn't installed. You need to get the compile step working before you move on to installing it.
A lesson in compiling python extensions is needed, which distribution are you using ? You seem to be missing the sqlite headers with the given macro definitions. When the python setup runs it compiles bindings to the sqlite native binary and copies a few .py files to the library. The _sqlite is typically a .pyd file (equivalent to a dll) which has calls to the sqlite library, in your case that did not get built.
Check the presence of the sqlite headers etc.
The correct way to build pysqlite is now on the website.
$ tar xvfz <version>.tar.gz
$ cd <version>
$ python setup.py build_static install
The build_static will download the latest sqlite code and statically compile against it. For a note I just did this on a 1and1 shared host.
http://trac.edgewall.org/wiki/PySqlite#Buildingpysqlite

Categories

Resources