Compiling gVim with Python 3 support - python

I hope this is the right place to ask this question:
I am trying to compile gVim with python 3 support using cygwin under windows:
I changed the Make_cyg.mak files Python section to the following:
##############################
# DYNAMIC_PYTHON=yes works.
# DYNAMIC_PYTHON=no does not (unresolved externals on link).
##############################
ifdef PYTHON
DEFINES += -DFEAT_PYTHON
INCLUDES += -I$(PYTHON)/include
EXTRA_OBJS += $(OUTDIR)/if_python.o
ifndef DYNAMIC_PYTHON
DYNAMIC_PYTHON = yes
endif
ifndef PYTHON_VER
PYTHON_VER = 30
endif
ifeq (yes, $(DYNAMIC_PYTHON))
DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
else
EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
endif
endif
However when running:
$ make -f Make_cyg.mak OLE=Yes PYTHON=/cygdrive/p/Applications/PortablePython_1.1_py3.0.1/App/ RUBY=/cygdrive/c/Programme/Ruby/
this results in the following errors:
In file included from /cygdrive/p/Applications/PortablePython_1.1_py3.0.1/App//i
nclude/Python.h:70,
from if_python.c:43:
/cygdrive/p/Applications/PortablePython_1.1_py3.0.1/App//include/bytesobject.h:1
04:1: warning: "F_BLANK" redefined
In file included from globals.h:1554,
from vim.h:1831,
from if_python.c:20:
farsi.h:74:1: warning: this is the location of the previous definition
if_python.c:729: warning: initialization makes integer from pointer without a ca
st
if_python.c:733: warning: initialization from incompatible pointer type
if_python.c:734: warning: initialization from incompatible pointer type
if_python.c:735: warning: initialization from incompatible pointer type
if_python.c:737: error: `cmpfunc' undeclared here (not in a function)
if_python.c:737: error: initializer element is not constant
if_python.c:737: error: (near initialization for `OutputType.tp_repr')
if_python.c:737: error: parse error before numeric constant
/** more errors **/
if_python.c:2256: warning: initialization from incompatible pointer type
if_python.c:2257: warning: initialization from incompatible pointer type
if_python.c: In function `PythonMod_Init':
if_python.c:2351: error: structure has no member named `ob_type'
if_python.c:2352: error: structure has no member named `ob_type'
if_python.c:2353: error: structure has no member named `ob_type'
if_python.c:2354: error: structure has no member named `ob_type'
if_python.c:2355: error: structure has no member named `ob_type'
if_python.c:2356: error: structure has no member named `ob_type'
make: *** [gobj/if_python.o] Error 1
I am using a portable python install from Portable Python. I don't know if that may be the source of the error.
I am hoping someone knows how to compile vim with python 3 support (if I only compile it with ruby support it compiles nicely).
Thanks in advance,
Gjallar

I have compiled vim with python3 support. Here is the Patch updated for vim 7.2.411.
For compilation instruction check out my 2009 September 22 mail on
groups.google.com/group/vim_dev/browse_frm/month/2009-09
(adding a second hyperlink didn't work)

There is a lot of things going on at once here. First of all, why do you want Python 3.0? If you really want Python 3, then you should use Python 3.1.
Second of all, what does "Python 3 support" mean in the case of gVim? Is it to make extensions with Python? Then you don't want Python 3 support, as any extension that exists for gVim is going to be written for Python 2.
And yeah, it seems very strange to use portable python. Since you are compiling gVim with cygwin, you should reasonably use a Python compiled with the same Cygwin.
Doesn't the normal gvim for Windows have Python support?

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.

python monary 0.2.3 (mongo monary driver): error in setup on windows 64bit (Anaconda distribution)

I read about python+mongo+monary is extremly fast for numpy panda processing working with mongodb on
Alex Gaudio's blog http://alexgaudio.com/2012/07/07/monarymongopandas.html
I am trying to install monary driver, which i picked up from
https://pypi.python.org/pypi/Monary on windows 64 bit. I have Ananconda python 2.7 distribution.
python ./setup.py install
I am getting following conflict error.
monary/cmonary.c:46:20: error: conflicting types for 'OBJECTID'
In file included from e:\anaconda\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/
../../../../x86_64-w64-mingw32/include/windef.h:137:0,
from e:\anaconda\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/
../../../../x86_64-w64-mingw32/include/windows.h:59,
from mongodb-mongo-c-driver-74cc0b8/src/mongo.h:25,
from monary/cmonary.c:8:
e:\anaconda\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64
-mingw32/include/winnt.h:457:5: note: previous declaration of 'OBJECTID' was her
e
monary/cmonary.c: In function 'monary_load_timestamp_value':
monary/cmonary.c:247:9: warning: dereferencing type-punned pointer will break st
rict-aliasing rules [-Wstrict-aliasing]
monary/cmonary.c: In function 'monary_load_query':
monary/cmonary.c:519:9: warning: unused variable 'total_values' [-Wunused-variab
le]
error: command 'E:\\Anaconda\\Scripts\\gcc.bat' failed with exit status 1
I can change all all reference of OBJECTID in monary to something like BOBJECTID and get rid of re-definition or undef OBJECTID before, I dont know the side effects of same? looking for an answer or a windows install of Monary
You need to have MinGW installed (http://www.mingw.org/) and use it to install gcc. Then you need to add C:\MinGW\bin (or whatever your install path is) to your PATH variable like in this answer:
libgmp-10.dll is missing

Error with PyML build

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/"

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