McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 54 forks source link

mcgui 3.4 windows issue #1552

Open pkaracosta opened 8 months ago

pkaracosta commented 8 months ago

Hi, there is an issue with the GUI not running both from shortcut and the shell.

C:\Users\user>mcgui Traceback (most recent call last): File "C:\mcstas-3.4\lib\tools\Python\mcgui\mcgui.py", line 15, in from PyQt5 import QtCore, QtWidgets ImportError: DLL load failed while importing QtCore: The specified module could not be found.

Tried updating to latest python version and installing PyQt5 but no luck so far (windows). Thanks!

willend commented 8 months ago

Hi @pkaracosta

Sorry for not getting back to you before, have been busy running a McStas school. :)

If I remember correctly you may have an Anaconda Python installed “globally” on your Windows machine? (I.e. try starting a normal cmd.exe shell and write python --version to see if this is the case?)

If this is the case, very likely the “embedded” Python brought along with the installation of McStas 3.4 is likely colliding with that Python version - and the cure/workaround is potentially as simple as renaming your folderc:\mcstas-3.4\miniconda3 to something else, e.g. c:\mcstas-3.4\miniconda3gone

Try this and see what happens?

(We may have to install McStas dependencies to your "system" Python - the list is available here: https://github.com/McStasMcXtrace/McCode/blob/main/environment.yml)

Best,

Peter

pkaracosta commented 8 months ago

Thanks Peter, this solved it!! Best, Petroula

willend commented 8 months ago

Great! I will see what can be done to avoid this problem going forward with McStas 3.5.

GustiLoesch commented 3 months ago

Hey there,

I seem to have the exact same problem. I wanted to upgrade to McStas 3.4 from 3.3 and now i get the same error message when trying to start the gui from the shell. The thing is i get the same problem with version 2.7.2 that i downloaded just to check, but in version 3.3 the gui works fine. I tried renaming the folder c:\mcstas-3.4\miniconda3 but that also didnt work.

Best Augustin

willend commented 3 months ago

@GustiLoesch quite certain there is a clash between "system" Python ( Anaconda? ) and the embedded one in your McStas.

I have three possible workarounds for you:

  1. Try replacing your miniconda3 folder with the content of the zip file found here: https://tmp.mcstas.org/Windows/
  2. Install WSL and use McStas through that - see https://github.com/McStasMcXtrace/McCode/blob/main/INSTALL-McStas-3.x/Windows/WSL/README.md
  3. If you can live without NCrystal and MCPL support you may also simply try installing (the experimental !!) McStas 3.x packages from conda-forge, follow the instructions at https://github.com/conda-forge/mcstas-suite-feedstock

Best of luck Peter

GustiLoesch commented 3 months ago

Thank you :) The first workaround fixed it. Just out of curiosity, what is different to the miniconda folder that comes with the metapackage from the Installation via Github?

willend commented 3 months ago

@GustiLoesch good to hear!

That installation was made on a machine where I was certain no other Python was present at install time. (I believe we are looking at a problem of detecting Qt "already available" on the surrounding system but linked to / matching another Python version...)

willend commented 3 months ago

@GustiLoesch and @pkaracosta I have reworked the installation procedure, you may try it out via the outputs of this GitHub worker run: https://github.com/McStasMcXtrace/McCode/actions/runs/9536639410

(Windows installer is included in the "ubuntu" artefact as it a cross-compile)

Screenshot 2024-06-16 at 17 02 31