Installing Beancount on Windows

1,088 views
Skip to first unread message

redst...@gmail.com

unread,
Jun 8, 2015, 7:48:10 PM6/8/15
to bean...@googlegroups.com
Starting a new thread for installation of Beancount on Windows. This came from this thread: https://groups.google.com/d/msg/beancount/qaZS7sMbiHs/firV9jRW0AEJ
 
I tried to install Beancount on Windows and have been unsuccessful so far. I haven't spent much time on it though. The problem is, the install process requires C compilation at some stage, and this fails:

src/python/beancount/parser/parser.c: In function 'PyInit__parser': <command-line>:0:20: error: invalid suffix "f1cf...." on integer constant
src/python/beancount/parser/parser.c:272:50: note: in expansion of macro 'PARSE_SOURCE_HASH'

Steps to get this far:
1) Install Python-3.4 under Windows
2) Install MinGW32 for Windows. I believe the MinGW Base System (chosen via the MinGW installer) is adequate, though I'm not sure.
4) Set your PATH in a cmd window to include both MinGW\bin and \Python34
5) Open a cmd window and follow beancount install instructions

Perhaps this will work better if Visual C++ is used instead of MinGW, I don't know. I haven't dug any deeper. I'll post if I do.

Martin Blais

unread,
Jun 10, 2015, 2:00:06 AM6/10/15
to redst...@gmail.com, bean...@googlegroups.com
I created a 2012 Windows VM on gcloud and succesfully built a working install of Beancount using Cygwin on it. It was surprisingly easy, and all the unit test just passed with no changes.

Here's how to do this:

  • Install the latest Cygwin. This may take a while (it downloads a lot of stuff), but it is well worth it in any case. But before you kick off the install, make sure the following packages are all manually enabled in the interface provided by setup.exe (they’re not selected by default):

    • python3

    • python3-setuptools

    • mercurial

    • make

    • gcc-core

    • flex

    • bison

    • wget

  • Start a new Cygwin bash shell (there should be a new icon on your desktop) and install the pip3 installer tool by running this command:
    easy_install3.3 pip

At this point, you should be able to follow the regular instructions from the install file.


I rewrote the installation instructions to be much more brief and simple and include a section specifically on installing on Windows:

(The way it was written before made it sound a lot more complicated than it actually is.)




--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/43da7855-b0c8-44eb-b8cb-76877dc6d55a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

redst...@gmail.com

unread,
Jun 10, 2015, 2:25:25 AM6/10/15
to bean...@googlegroups.com, redst...@gmail.com
On Tuesday, June 9, 2015 at 11:00:06 PM UTC-7, Martin Blais wrote:
I created a 2012 Windows VM on gcloud and succesfully built a working install of Beancount using Cygwin on it. It was surprisingly easy, and all the unit test just passed with no changes.

Great, thanks for posting this!

The problem when I tried this a while ago was a cygwin install that didn't have a working python 3.4. Didn't know how old that was, but looks like now it does. That's great. I'll try it out soon.

ma.k...@gmail.com

unread,
Jun 10, 2015, 4:51:49 AM6/10/15
to bean...@googlegroups.com, redst...@gmail.com
Thanks for looking into this Martin!

I must say that I'd rather not install the heavyweight cygwin by itself. I'd rather figure out how to use it with my current Python installation and it still appears possible. Somewhat more tedious, but ultimately more helpful if I can share it afterwards.

Looking at the install docs, I cannot find the ncurses requirement anymore, so I assume this is a non-issue now. wget can be found inside the git for Windows installation and it's only required for bean-bake (the web server, right?)

The compiler requirements are there because you are using cython at some point, I presume?
Flex/bison: can we run these on Linux and work with the their output on Windows?
What is make for? Or is all of this only for the lexer, grammar, parser.c?

Best regards,
Matthias

Martin Blais

unread,
Jun 10, 2015, 2:22:23 PM6/10/15
to bean...@googlegroups.com
Beancount only requires 3.3.

Shortly after 3.5 ships I'll probably bump up the requirement because I really want to start playing around with typing and start using mypy.

 


Martin Blais

unread,
Jun 10, 2015, 2:24:48 PM6/10/15
to bean...@googlegroups.com, redst...@gmail.com
On Wed, Jun 10, 2015 at 4:51 AM, <ma.k...@gmail.com> wrote:
Thanks for looking into this Martin!

I must say that I'd rather not install the heavyweight cygwin by itself. I'd rather figure out how to use it with my current Python installation and it still appears possible. Somewhat more tedious, but ultimately more helpful if I can share it afterwards.

Yes, I think it's possible.
The thing is, under Windows you have to build with whatever MSVCRT dll Python has been built with, and IIRC C/Python is built using MSVC, so you would need that installed for it to work. I think setup.py should already be able to trigger an MSVC build on Windows (unverified).


Looking at the install docs, I cannot find the ncurses requirement anymore, so I assume this is a non-issue now.

It was always a non-issue


 
wget can be found inside the git for Windows installation and it's only required for bean-bake (the web server, right?)

The compiler requirements are there because you are using cython at some point, I presume?
Flex/bison: can we run these on Linux and work with the their output on Windows?
What is make for? Or is all of this only for the lexer, grammar, parser.c?

Best regards,
Matthias

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.

Martin Blais

unread,
Jun 10, 2015, 2:28:55 PM6/10/15
to Martin Blais, bean...@googlegroups.com, redst...@gmail.com
Sorry, I fat fingered this email,  working on a laptop on a chair with tight elbow rests


On Wed, Jun 10, 2015 at 2:24 PM, Martin Blais <bl...@furius.ca> wrote:
On Wed, Jun 10, 2015 at 4:51 AM, <ma.k...@gmail.com> wrote:
Thanks for looking into this Martin!

I must say that I'd rather not install the heavyweight cygwin by itself. I'd rather figure out how to use it with my current Python installation and it still appears possible. Somewhat more tedious, but ultimately more helpful if I can share it afterwards.

Yes, I think it's possible.
The thing is, under Windows you have to build with whatever MSVCRT dll Python has been built with, and IIRC C/Python is built using MSVC, so you would need that installed for it to work. I think setup.py should already be able to trigger an MSVC build on Windows (unverified).


Looking at the install docs, I cannot find the ncurses requirement anymore, so I assume this is a non-issue now.

It was always a non-issue

See here:

It was always a non-issue, I only added that because a single user was using SUSE Linux and somehow that platform packaged curses as a separate install. You won't need to do anything. 99.999% sure you  already have curses.

 
 
wget can be found inside the git for Windows installation and it's only required for bean-bake (the web server, right?)

Yes, you do'nt need it.

I think I'll rewrite it in Python to remove the depedency.



 

The compiler requirements are there because you are using cython at some point, I presume?

No, no Cython here.

 
Flex/bison: can we run these on Linux and work with the their output on Windows?

Works with Cygwin, outside of it, probably not the best idea.
You don't need it anyhow, I check in the generated .h/.c files for this very reason.



What is make for? Or is all of this only for the lexer, grammar, parser.c?

Yes, that's it.

You just need to build the C code under beancount/src/python/beancount/parser/...
Using:
sudo python3 setup.py build_ext -i

Matthias Kauer

unread,
Jun 10, 2015, 8:54:06 PM6/10/15
to bean...@googlegroups.com, redst...@gmail.com
Thank you very much for the detailed explanation.
This sounds like it is more or less within my comfort zone of packaging for Windows with PyInstaller or cx_freeze. 

Only curses has me worried a bit b/c I have no idea if Windows brings anything like it. Looking around it seems like people always resort to cygwin if ncurses is involved. Is it used in the c files or from the Python main code?

This makes me somewhat hopeful: http://sourceforge.net/p/mingw-w64/wiki2/NCurses/ However, I haven't built for Python w/ mingw yet. I've heard it's possible though.
I might use the mingw-compiled ncurses binaries from here: http://invisible-island.net/ncurses/
This gist about vim compilation for Windows uses pdcurses instead of ncurses. https://gist.github.com/rpuntaie/8510218 This might be an option here as well.
Ok, enough research for now :)

Martin Blais

unread,
Jun 10, 2015, 10:02:06 PM6/10/15
to bean...@googlegroups.com
I can _easily_ make my use of curses entirely optional. 
It's _only_ used to set default values for the width of the screen for the table renderer in bean-query.
In fact, I'll go change the code right away to degrade gracefully to good default values if the module isn't available.
Please stop worry about curses.



Martin Blais

unread,
Jun 10, 2015, 10:34:11 PM6/10/15
to bean...@googlegroups.com
curses is not a dependency anymore:

I removed it from the install doc, from checkdeps, and if you don't have it, everything should work completely normally, on any platform.

Matthias Kauer

unread,
Jun 11, 2015, 11:51:09 PM6/11/15
to bean...@googlegroups.com
This has been a tremendously fast change. Now I feel some zugzwang. I'll try to set something up this weekend. Let's see :)

lwa...@gmail.com

unread,
May 12, 2016, 6:29:33 PM5/12/16
to Beancount, redst...@gmail.com

I was able to compile under cygwin, but I want to deploy beancount to run on a WIndows machine without cygwin on it. Is there anyway to run the cygwin compiled version from the Windows command prompt or git bash?

I've also been trying to compile under Visual C++. I'm running into a number of problems:

1) No unistd.h file (I created a fake one and got past this for now)
2) Lots of warnings mainly about converting from size_t to int
3) A compile error parser.c (273) error C2059: syntax error: 'bad suffix on number'. This is the line which uses the PARSER_SOURCE_HASH macro. Looking on StackOverflow this is probably that and unsigned long int is being used and Visual C++ wants an unsigned __int64(or something like that.)

Does anyone know how to get past these issues?

Thanks,

Len
Reply all
Reply to author
Forward
0 new messages