Challenges with Python Extensions

Hi, any ideas on how I can get the Python extensions working? I can’t get very far with writing one until I can test it…

Essentially, on all versions of the program I try, a script added manually to ~/.local/share/OpenChemistry/Avogadro/commands/<script_name>/<> along with a plugin.json fails to load and doesn’t change anything in the program, even when the script is one of yours. Meanwhile, other Python-related functionality is very variable in what works and what doesn’t.

With the nightly AppImage I observe:

  • 47 extensions reported found
  • Input menu is fully populated and menu items open dialog windows seemingly correctly
  • Download plugins window is empty other than the frames, table headings, and Download selected button
  • Any extension scripts that are found are not loaded, with lines such as "Cannot load script /tmp/.mount_AvogadNf9qIX/usr/lib/avogadro2/scripts/energy/" printed to the terminal
  • This includes scripts manually downloaded and placed in ~/.local/share/OpenChemistry/Avogadro/commands/avogadro-scikit-nano, such as avogadro-scikit-nano that would ordinarily be in Download plugins
  • As a result of the above, Extensions | Calculate | Configure... only offers LJ as an option
  • I also get – and I only see this with the AppImage – this error: QSslSocket: cannot resolve EVP_PKEY_base_id QSslSocket: cannot resolve SSL_get_peer_certificate

On the other hand, with my self-compiled Qt6 version I observe different behaviour:

  • Fewer extension plugins are reported as having been dynamically found (30) – did I compile wrong or not download enough of the repos?
  • Terminal output only reports having checked for energy scripts and formatScripts scriptsno commands or inputGenerators or charges
  • Energy scripts also all fail to load so LJ is still only available model
  • Input menu only contains entries for LAMMPS and OpenMM
  • Extensions is missing various entries including Yaehmop and Set Python Path...
  • Download plugins is populated but trying to download anything doesn’t seem to do anything

With a version compiled against Qt5:

  • 41 extensions reported found
  • All five types of script are checked for
  • Lots of failed to load messages including for all the energy and commands scripts
  • Input and Extensions contain more options but not all of them
  • Download plugins is populated, and choosing an option and clicking install gives a message like:

Downloading to /home/matt/.local/share/OpenChemistry/Avogadro
Extracting /home/matt/.local/share/OpenChemistry/Avogadro/ to /home/matt/.local/share/OpenChemistry/Avogadro/commands/
Finished 8 files
Extraction successful

I’ve attached the terminal output for each.

AppImage.txt (5.3 KB)
Qt5.txt (4.9 KB)
Qt6.txt (2.4 KB)

I moved this to a new topic.


While the AppImage is convenient, it’s clear that some aspects either run in some sort of sandbox or are otherwise different than a regular Linux environment. Since I don’t have a Linux machine handy, it’s a bit hard to debug.

In particular, I think you need to add some permission to get network access (eg. the download plugin feature)

  • Any extension scripts that are found are not loaded, with lines such as "Cannot load script /tmp/.mount_AvogadNf9qIX/usr/lib/avogadro2/scripts/energy/"printed to the terminal

I think the question is whether the AppImage has access to a Python with openbabel installed (probably not).

This includes scripts manually downloaded and placed in ~/.local/share/OpenChemistry/Avogadro/commands/

Similarly, if the AppImage can’t access a Python environment with scikit-nano, it’s not going to work.

Qt 5

I’m going to skip Qt6 – I think not all of the features have been ported to Qt6 because of changes to some of the classes (e.g., regular expressions). That clearly includes many of the Python features.

This is where I’d start. What do you mean by “lots of failed to load” … are these scripts that you have installed the relevant Python package? Have you set the Python path for this build?

Based on your output, it seems like:

  • you haven’t installed scikit-nano so that doesn’t load
  • you haven’t installed xtb-python so GFN-FF, etc. don’t load
  • you haven’t installed requirements for nanocar (which includes ase among other things)
  • you don’t have antechamber in your path, so that charge script doesn’t load

I’d have to see how you’re handling avo_xtb/ Generally, Avogadro is just running:

python avo_xtb/ --display-name # make sure the script works

OK with regards to this it seems like it’s a known issue and the problem was that the AppImage was built against OpenSSL 1.1, while I only had 3.1 installed. This results in QSsl not working, as OpenSSL is not bundled with AppImages, see here. I opened this GitHub issue with more details.

After installing OpenSSL 1.1 from the OpenSUSE repos the plugin installer works perfectly in the AppImage.

Yes, this also seems to be an issue on Windows.

Ah thanks for your pointers, I hadn’t realized that by coincidence, all the extensions I installed had external dependencies. I found one or two that don’t have any and they indeed work fine!

By running your example Python command by hand I discovered that I simply had a syntax error in my script, oops. Very sorry to take up your time over a dumb error…

Would it be possible to have Avogadro print the Python stdout as well? This would in general help with debugging, and would make clear why any Python processes fail.

Yes, I need to finish up some support for installing dependencies.

Set AVO_PYTHON_SCRIPT_DEBUG in the environment. I’m pretty sure that’s in the script documentation, but maybe it needs to be more prominent.

For commands and generators, I’ll polish up some scripts to help debugging / testing. Basically, they query for options and then feed defaults back when running the script normally.