It seems like the reliance of Avogadro on Python for key functionality is only going to increase, so for a good user experience a Python installation is becoming a prerequisite.
As such, the necessity of various improvements to the way Python integration is handled by Avogadro, including helping the user to install Python if it is not already, using virtual environments, and allowing plugins to install dependencies, has been mentioned in various GitHub issues: #1391, #1428, and #1449.
There is the idea that the Windows installer for Avogadro should at least offer to install Python via a miniforge installation.
I have also seen a lot of questions on the forum along the lines of “Why isn’t this working?” where the answer is simply: “you need to set up Python” and/or “install these Python packages”. From my own experience and that of friends and colleagues, this is unlikely to be something easy for a non-computational chemist and certainly not something they really know how to do in the right way. These are also support tickets that could be avoided altogether if it is handled by Avo.
In general you seem to be a fan of conda
, @ghutchis. And having begun using it for my own projects recently it certainly seems better for chemistry than pip
, since non-Python things like Open Babel, xtb, CREST, are in it too.
I’m interested to hear why I would be naive and wrong for having the impression that the easiest way to manage Python in Avogadro would be to make conda
either a dependency or a requirement for the Python functionality.
Some sort of initialization procedure on the first start of Avogadro could check if conda
is already installed (just to avoid duplication), and if not, could offer to the user to install it in order to “enable all features of Avogadro” i.e. unlock the Python-dependent functionality. If declined, the same offer could be triggered later if the user attempts to install or use plugins.
Ensuring the presence of conda
seems like it would have multiple advantages:
-
An Avogadro user doesn’t need to know anything about how Python works, how to install it, or how to manage virtual environments – the latter is really a difficult thing for new Python users
-
Avogadro could create its own
avogadro2
conda environment, allowing it to manage all dependencies independent of the system or the user’s other Python work -
The Python version can then be setup so Avogadro can choose what version of Python is used by it for any given release, improving compatibility
-
Plugins can install any dependencies they need in that environment by providing a
environment.yml
file or similar, this could optionally be extended to allow plugins to have their own conda environment if needed in future- (However Avogadro handles Python dependencies going forward, venv management is going to be unavoidable, as it can’t instal anything with
pip
into the system Python environment otherwise it might mess up the OS for Linux users)
- (However Avogadro handles Python dependencies going forward, venv management is going to be unavoidable, as it can’t instal anything with
-
A lot of time and coding effort would be solved by not having to worry about other sources of Python or packages or environments e.g. system Python,
pip
,homebrew
, Linux distro packages, it is no longer necessary to get the user to provide the Python path or a virtual environment. #1391 in particular has the suggestion of handling both conda and pip and requiring user intervention -
Installation of useful open-source software such as
xtb
(potentially even Open Babel itself?) could be managed easily by Avogadro without user intervention e.g. via a simple click to install interface within the GUI. This would allow #1447 to happen pretty easily!
The only real disadvantage I can see is that miniforge
is added to Avogadro’s footprint, which is a) negligible and b) only necessary if the user doesn’t already have conda
.
I’m sure I’m missing good reasons why this is a bad idea, but it seems like a fairly simple solution for Avogadro to deal with the mess that is Python environments and save a lot of work…
I look forward to my ignorance being expounded!