beanquery error on Windows

56 views
Skip to first unread message

Chary Chary

unread,
Feb 3, 2023, 2:17:42 PM2/3/23
to Beancount
Dear all,

what is the current status of beanquery as a standalone tool?

If there any updated documentation available?

I cloned it from github, but when I try to run py sheel.py, I get the following error:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "<frozen site>", line 186, in addpackage
  File "<string>", line 1, in <module>
  File "<frozen importlib.util>", line 14, in <module>
  File "C:\Users\Chary\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 7, in <module>
    from functools import wraps
  File "C:\Users\Chary\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 22, in <module>
    from types import GenericAlias
ImportError: cannot import name 'GenericAlias' from 'types' (C:\_code\py\beanquery\beanquery\types.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen site>", line 616, in <module>
  File "<frozen site>", line 603, in main
  File "<frozen site>", line 384, in addsitepackages
  File "<frozen site>", line 226, in addsitedir
  File "<frozen site>", line 196, in addpackage
  File "C:\Users\Chary\AppData\Local\Programs\Python\Python311\Lib\traceback.py", line 5, in <module>
    import linecache
  File "C:\Users\Chary\AppData\Local\Programs\Python\Python311\Lib\linecache.py", line 8, in <module>
    import functools
  File "C:\Users\Chary\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 22, in <module>
    from types import GenericAlias
ImportError: cannot import name 'GenericAlias' from 'types' (C:\_code\py\beanquery\beanquery\types.py)



Daniele Nicolodi

unread,
Feb 3, 2023, 3:34:15 PM2/3/23
to bean...@googlegroups.com
On 03/02/23 20:17, Chary Chary wrote:
> Dear all,
>
> what is the current status of beanquery as a standalone tool?

It works.

> If there any updated documentation available?

Not really. The documentation for bean-query and the Beancount Query
Language (BQL) still applies with few exceptions.

> I cloned it from github, but when I try to run py sheel.py,I get the
> following error:

That's not how you use most Python packages. You need to install the
package, which will provide a bean-query command:

python -m pip install git+https://github.com/beancount/beanquery.git

Please refer to the Python documentation for more details, for example
the Python guide on installing packages
https://packaging.python.org/en/latest/tutorials/installing-packages/

I would like to tie up some loose ends before publishing a release, but
hacking time is a scarce resource thee days.

Cheers,
Dan

Chary Chary

unread,
Feb 4, 2023, 6:34:40 AM2/4/23
to Beancount
Dean,

thanks for reply, but I was looking for a way to install it for hacking/development

E.g. with beancount I can do git clone, then run   py setup.py build_ext -i 

After that I run the py beancount\beancount\query>shell.py "beanfile.bean" it will work

Is it possible to install the standalone version of the beanquery for  hacking/development ?

Daniele Nicolodi

unread,
Feb 4, 2023, 7:26:26 AM2/4/23
to bean...@googlegroups.com
On 04/02/23 12:34, Chary Chary wrote:
> Dean,
>
> thanks for reply, but I was looking for a way to install it for
> hacking/development
>
> E.g. with beancount I can do git clone, then run py setup.py build_ext -i
>
> After that I run the py beancount\beancount\query>shell.py
> "beanfile.bean" it will work

No, it does not.

Unless, you also install the beancount package somehow or you set the
PYTHONPATH environment variable, or something, otherwise you get a
"ModuleNotFoundError: No module named 'beancount'" error.

> Is it possible to install the standalone version of the beanquery for
> hacking/development ?

Sure, it is possible:

git clone https://github.com/beancount/beanquery.git
cd beanquery
python3.11 -m beanquery --help

Just make sure to install the required dependencies.

There is nothing special about beanquery, it is a standard Python
package. Please refer to the Python documentation for details.

Cheers,
Dan

Martin Blais

unread,
Feb 4, 2023, 9:30:48 AM2/4/23
to bean...@googlegroups.com
+1 
More or less what I do, I have a path to $PROJECTS/beanquery/bin

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/80bfa8ec-acee-8af5-f0c9-4b8c28e99cac%40grinta.net.

Chary Chary

unread,
Feb 6, 2023, 7:26:28 AM2/6/23
to Beancount
On Saturday, February 4, 2023 at 1:26:26 PM UTC+1 dan...@grinta.net wrote:
On 04/02/23 12:34, Chary Chary wrote:
> Dean,
>
> thanks for reply, but I was looking for a way to install it for
> hacking/development
>
> E.g. with beancount I can do git clone, then run py setup.py build_ext -i
>
> After that I run the py beancount\beancount\query>shell.py
> "beanfile.bean" it will work

No, it does not.

Unless, you also install the beancount package somehow or you set the
PYTHONPATH environment variable, or something, otherwise you get a
"ModuleNotFoundError: No module named 'beancount'" error.

> Is it possible to install the standalone version of the beanquery for
> hacking/development ?

Sure, it is possible:

git clone https://github.com/beancount/beanquery.git
cd beanquery
python3.11 -m beanquery --help

Dan,

thanks, it works this way! Note: I think it would be nice to add short note about this in the readme.md
Reply all
Reply to author
Forward
0 new messages