OpenChemistry / avogadrolibs

Avogadro libraries provide 3D rendering, visualization, analysis and data processing useful in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas.
https://two.avogadro.cc/
BSD 3-Clause "New" or "Revised" License
450 stars 174 forks source link

Consider how to package Python as an optional install for Windows #1449

Open ghutchis opened 12 months ago

ghutchis commented 12 months ago

Many features in Avogadro2 expect to find Python in the path.

This would be much easier on Windows if there was a miniconda build, for example, for most users.

Someone should examine how to bundle our NSIS installer with Miniconda: https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe

For example, it seems like it's possible https://github.com/conda-forge/miniforge?tab=readme-ov-file#non-interactive-install

start /wait "" Miniforge3-Windows-x86_64.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%UserProfile%\Miniforge3
Surajjalpun2002 commented 12 months ago

will you be assigning this to a particular individual?

ghutchis commented 12 months ago

No, although you seem to be the first interested in helping, so thanks very much for the offer.

I don't know if it's easier to create a new installer that combines Avogadro + Miniforge, etc. .. I don't know much about NSIS since I don't use Windows.

matterhorn103 commented 11 months ago

Couldn't we just bundle with the Python installer on Windows and execute it via the command line rather than bundling miniconda?

ghutchis commented 11 months ago

If I'm choosing between the official Python installer and miniconda, I'd go with a miniforge install because it will make installing other packages and setting up environments easier.

As to how it's installed, I don't care - only that it be optional since some people may already have Python installed on Windows.

Surajjalpun2002 commented 11 months ago

I am not sure if I am right, but from what I have searched, I would need the NSIS script used in Avogadro's NSIS installer (which i cant find) and then I might be able to add the miniforge installation conditions within it, although i am not sure yet , as i have tried to install miniforge with simple nsis scripts but failed.

Harshiths1 commented 11 months ago

Do you want a NSIS script (.nsi file) that includes the Miniconda installer (this script downloads the Miniconda installer (Miniconda3-latest-Windows-x86_64.exe) and installs it silently (/S) to the specified directory (/D=C:\Miniconda3) We could then adjust the paths as per requirements) or do you want to add Miniconda's Scripts and base directories to the PATH in the system registry while instillation itself .

ghutchis commented 11 months ago

I would want an NSIS script that offers the option to the user to install Miniconda (the default) .. potentially /S to a specified directory (default = C:\Miniconda3) during installation of Avogadro.

I don't know enough about NSIS to know how to do that (e.g., do you modify the Avogadro .nsi script or create a new script that loads both installers).

harshit4311 commented 11 months ago

I would love working on this issue! Could you please assign it to me?

Harshiths1 commented 11 months ago

I have figured out a way by using the nsDialogs plugins but am not able to find the existing script file through which the current feature has to be added.

Harshiths1 commented 11 months ago

@ghutchis sir how would we test it as the (.exe) file is directly created with the required functionalities as I have build it with a custom script .

avo-bot commented 11 months ago

This issue has been mentioned on Avogadro Discussion. There might be relevant details there:

https://discuss.avogadro.cc/t/managing-python/5098/1

matterhorn103 commented 8 months ago

Just want to make a note that these days it's also possible to install miniforge on Windows (or at least, get the installer) using

winget install CondaForge.Miniforge3
matterhorn103 commented 8 months ago

And indeed installing via winget both downloads and installs miniforge in non-interactive mode. So the Avogadro installer would simply need to execute the above command and nothing more, if that's possible.

matterhorn103 commented 8 months ago

@ghutchis Is there an existing .nsi script? No one seems to be able to find it, myself included. If it doesn't exist, how is the Windows installer currently being prepared? I've searched through a lot of the repo and found nothing...

The other option is that rather than the suggestion to install Python coming at install time, the user is instead prompted on first launch, since there was the idea to have a "Setup Python environment" dialog pop up anyway.

Even if it happens in the installer, it will still be necessary to have an option in the GUI somewhere (maybe in "Python Settings") to do the same thing, so that people who choose no at install time and then change their mind don't have to reinstall.

ghutchis commented 8 months ago

Right now, it's handled by cpack with options in the avogadroapp repo, e.g.: https://github.com/OpenChemistry/avogadroapp/blob/master/cmake/AvogadroCPackOptions.cmake.in

I agree that it's probably a nice idea to have it prompt in the first launch, although I can imagine in a lab setting, it might be better to have it in both places.

If the command is run more than once, what happens to the previous install?