Setting up Gramps development in VM or in WSL

I am interested in setting up a Gramps development environment, either in a VOM (Windows Host) or under WSL.
I currently have a VM environment setup in a VirtualBox running Mint 20 and am looking how to best debug and follow the execution with a view to working on both the built-in metadata display gramplet and the add-on for editing metadata.

My VM is running the latest Gramps code from Github. When I execute the code directly from the command line, it produces a pile of error messages regarding a missing localedir and I have not found a way to fix that from my attempts at googling
This does not seem a big deal when running the app from the command line, but it does seem to really slow down ‘eric’ which I tried to use as a GUI debugger
If there are other options for a debugger, I am open to try them as well

1 Like

For debugging, you could try remote development using VS Code. It can be configured for Virtual Machines and WSL. I don’t know if that will help the performance or not.

1 Like

Thank you.
That stuff really looks like it would do the job, if I can only figure it all out :wink:

It will take me some time to sort out all of the background assumed as ‘obvious’ , but I will give it a shot.

You can install Visual Studio Code inside Linux too, if you want.

And if you still care, here’s the package source setting that you need:

… although it’s in Dutch, you can probably see what you need to do, which is to set the top option to I (on). Your version may look slightly different depending on GUI style, but the lay-out is the same.

Thank you, Enno

For now I will stick with the Windows host running VS.

Arnold

1 Like

Hi @metadata

Your thread nudged me to pick up on setting up a build environment which I attempted last year with some success, but did not complete. Today I picked up again and so far what I have is a basic setup where I can fetch code, install dependencies, setup the build and run gramps -v successfully. I’m on Windows 10 (21H2) with WSL2 so I wasn’t able to run the Gramps graphically, but it’s a start. If someone has Windows 11 Gramps should be able to run at this point.

Suggested prep:

Details are probably missing so feel free to add/correct the steps. Steps 7-9 are definitely not very clear as I had a previous setup and did not document everything I did.

  1. Clone Gramps repo on Windows, say to C:\Dev\Source\Gramps\gramps
  2. Fire up WSL Ubuntu shell
  3. cd /mnt/c/Dev/Source/Gramps/gramps
  4. Invoke VS Code: code .
  5. Install Python extension in WSL Ubuntu and reload. This will also install Pylance extension in WSL Ubuntu
  6. VSCode will ask to choose a Python interpreter from Ubuntu (2.7.x or 3.6.9) but it’s better to set up a virtual environment specific to Gramps
  7. Create a venv for gramps, e.g. in ~/pyvenv/gramps-venv
  8. Configure VSCode to look at your virtual environment folder: “python.venvPath”: “~/pyvenv”
  9. Now open gramps project with a python file open and choose the gramps-venv as the python environment.
  10. Follow instructions on Running a development version of Gramps.
  • Failed installing gramps build-dep on Ubuntu 20.04:
$ sudo apt-get build-dep gramps
Reading package lists... Done
E: You must put some 'source' URIs in your sources.list

While this was discussed in another thread recently, I used the following workaround: Found build-deps for gramps (5.1.3) and installed each package listed in Build-Depends-Indep list, e.g. sudo apt-get install dh-python gettext intltool etc.

$ python3 setup.py build

Ran into one error “msgfmt: cannot locate ITS rules for…”, and found solution on the web. Fix was to install appstream: sudo apt-get install appstream

Finally able to run:
$ python3 setup.py build
…ran successfully…

$ python3 Gramps.py
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

Gramps Settings:

python    : 3.8.10
gramps    : 5.2.0-ebddc51fa
gtk++     : 3.24.20
pygobject : 3.36.0
pango     : 1.44.7
cairo     : 1.16.0
pycairo   : 1.16.2
osmgpsmap : 1.0
GExiv2    : 0.10
ICU       : 66.1
PyICU     : 2.4.2
o.s.      : linux
kernel    : 4.4.0-19041-Microsoft

Environment settings:

LANG      : en_US.UTF-8
LANGUAGE  : en
GRAMPSI18N: not set
GRAMPSHOME: not set
GRAMPSDIR : not set
GRAMPS_RESOURCES : /mnt/c/Dev/Source/Gramps/gramps
PYTHONPATH:
/mnt/c/Dev/Source/Gramps/gramps/gramps
/mnt/c/Dev/Source/Gramps/gramps
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages

Non-Python dependencies:

Graphviz  : 2.43
Ghostscr. : Ghostscript not in system PATH

System PATH env variable:

    /usr/local/sbin
    /usr/local/bin
    /usr/sbin
    /usr/bin
    /sbin
    /bin
    ...
    /snap/bin

Databases:

bsddb     :
    version     : 6.2.7
    db version  : 5.3.28
    location    : /usr/lib/python3/dist-packages/bsddb3/__init__.py

sqlite3   :
    version     : 3.31.1
    py version  : 2.6.0
    location    : /usr/lib/python3.8/sqlite3/__init__.py

Thinking about that localedir … what are your language settings? If they’re not English, there may be some parts of Gramps that try to use English language files, and can’t find them. And you can cure that by installing the English language pack. It will not change your language settings, but it will add some resources. I do the same when I want to try things in French, or German.

After going through the recommendation from codefarmer to actually make
python3 setup.py build

run, all those warnings are gone.

Awesome! I realize now that after step 1-3, jumping straight to step 10 is enough to set up the build and run gramps -v. Steps 4-9 are for the next part of the journey to develop and debug gramps, which I haven’t done in this environment yet.

Before I start working on the WSL etc version, I would like to sort out why the code to make setup.py work is missing and whether it can be added back & how.
This issue seems to be quite independent of how one want to work.

By following responses in the thread “[Gramps-users] Gramps Development setup question” I was able to resolve the following issue:

On Ubuntu 20.04 uncommenting this line in /etc/apt/sources.list

deb-src http://archive.ubuntu.com/ubuntu/ focal universe

and then running sudo apt-get update allowed sudo apt-get build-dep gramps to run to completion successfully.

But will the rest work as expected??
Meanwhile I have been able to build a Gramps version in WSL (Ubuntu 20.04) and after manually installing all the files mentioned in the list from 5.1.3, (& sudo apt-get install appstream ) the command
python3 setup.py build ran to completion, though the output was apparently too large for the terminal buffer to hold it all.
Still, when I try to run Gramps.py, I get errors, such as “Unable to init server”, so evidently I am still missing something.
So at this point I am stuck :frowning:

Hi @metadata

With everything set up and building correctly, the only thing left to do on Windows 10 is the graphical display. Refer to @StoltHD 's suggestion to use GWSL as an Xserver on Win10. With that I was able to run both the installed version of Gramps and the locally built version too.

There is one Gramps error dialog on launch, but the program does run after acknowledging it: “2022-01-19 14:39:31.481: WARNING: grampsgui.py: line 538: GTK translations missing, GUI will be broken, especially for RTL languages!”

Running the local build is much slower and there are oddities like text now showing up in context menus, display refresh issues, and some hangs. Maybe you have a system with a better CPU/GPU to avoid such issues.

Good luck!

Gramps Incomplete GTK installation

Thank you for that link :slight_smile:
I did manage to install the GWSL XServer and got my VSC Gramps to hook up to it, though with a number of other warnings & errors besides the one you mentioned.

It does have the one nice feature of separating the Gramps display from the code.

But, by now, I think I can get the same effect, with less intermediate setup and software, by sharing my Windows-side Gramps code (with the editing done in VSC) folder with a VM and have the GUI displayed in the VM.

I’ll give that approach a try and see where it gets me

I believe that is mentioned in the requirements section of the readme

The following package is needed for full translation of the interface to your language:

  • language-pack-gnome-xx

Translation of GTK elements to your language, with xx your language code; e.g. for Dutch you need language-pack-gnome-nl. The translation of the Gramps strings is included with the Gramps source.

So looking at the screenshot it shows the language “en_US” is missing so maybe the package you need to install is:

language-pack-gnome-en

or

language-pack-gnome-en_US

I will have a look at that when it comes up for me.

I have meanwhile come very close to what I think I need & want.

My big problem with running Mint in a VMbox was the relatively cramped single screen, no room for a debugger as well as the relatively large screen real estate demanded by Gramps.

Today, I have been able to make my VM box run 2 fair sized screens - my main PC has 3 screens - so that I can still see where the PC is at, while I have a decent size display area for both the debugger (eric) and Gramps.

There seem to be other options, which I have not explored as yet, but for now, I will carry on with this arrangement.

1 Like

@daleathan Thank you. The first package was the missing one, and installing it resolved the warning, and context menus are now displaying text properly. Minor graphical draw/refresh issues remain, but nothing that stops Gramps from running.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.