[mcstas-users] Pyqt problem on fresh install

Peter Kjær Willendrup pkwi at fysik.dtu.dk
Thu Mar 24 16:05:09 CET 2022


Hi,


Good that you found a solution / hack . :-) I do think you should also make sure you have e.g. the Python mcrun, I believe this is what mcgui will be configured to use...

In regard to the tool layer, this is almost identical in 2.7.1 and 3.1. And 3.1 can be worth investing a little time in e.g. because of the (NVIDIA) GPU support.

See the relevant sections in https://github.com/McStasMcXtrace/McCode/wiki in regard to conversion of instruments (and your own comps).


Best
Peter



On 24 Mar 2022, at 16.01, Peter Kjær Willendrup <pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>> wrote:

Hi,


Hmm. Did you install the packages independently or using the “python metapackage”, i.e.
mcstas-suite-python (or mcstas-suite-python-ng in the case of 3.1)

You may also try to directly install the python mcrun package

apt-get install mcstas-tools-python-mcrun-2.7.1


Best,
Peter



On 24 Mar 2022, at 15.56, Jean-Francois Moulin <jean-francois.moulin at hereon.de<mailto:jean-francois.moulin at hereon.de>> wrote:


well,


This is what I see with a print statement at the beginning of mcgui.py

PyQt5.__file__ : /home/jfmoulin/.local/lib/python3.8/site-packages/PyQt5/__init__.py

So, yes, this is my pip installed Qt



Trying your sugestion:

    jfmoulin at jfm17:~$ mcstas-2.7.1-environment

    The new shell started here is now set up for running this version of mcstas:

    McStas version 2.7.1 (Oct. 04, 2021)
    Copyright (C) DTU Physics and Risoe National Laboratory, 1997-2021
    Additions (C) Institut Laue Langevin, 2003-2021
    All rights reserved

    To end using this version of mcstas, exit this shell.
---- (in this same  shell)

    jfmoulin at jfm17:~$ mcrun

    Command 'mcrun' not found, did you mean:

      command 'mcron' from deb mcron (1.0.8-1build1)
...

so, still no joy.

I tried here under 2.7.1 which is the one I installed after having the problem with 3.1 in the first place.


And, BTW, what is a desktop launcher ;0) (i.e, I called mcrun from a shell as reported in my previous mail. No clicking, I swear.)

Moreover, I seem to be stuck in the perl past for mcrun:


    jfmoulin at jfm17:~$ which mcgui
    /usr/share/mcstas/2.7.1/bin/mcgui
    --------------------------------------------------------------------------------

    jfmoulin at jfm17:~$ ls /usr/share/mcstas/2.7.1/bin/
    cif2hkl              mcformat    mcpl2ssw  mcstas         postinst
    mcdisplay-mantid.pl  mcgui       mcpltool  mcstas_errmsg  pymcpltool
    mcdoc.pl             mcpl2phits  mcrun.pl  phits2mcpl     ssw2mcpl


On 3/24/22 13:44, Peter Kjær Willendrup wrote:
Hi again,


I am quite sure your user environment could affect the Python environment that e.g. mcgui “sees”.

Your mcrun should in fact be sitting in the same directory where mcgui resides? But maybe you started it via a Desktop launcher?


Running (e.g.)
mcstas-3.1-environement

should give you a shell which knows about the Python mcrun?

Alternatively call mcrun with the full path, this should be something like
/usr/share/mcstas/3.1/bin/mcrun

mcrun.pl is “so much last year” ;-)


Best,
Peter


On 24 Mar 2022, at 13.30, Jean-Francois Moulin <jean-francois.moulin at hereon.de<mailto:jean-francois.moulin at hereon.de>> wrote:


Dear Peter,


thanks for your suggestions!

Synaptic shows:

    libqscintilla2-qt5-15 2.11.2+dfsg-6

My mint (20.3) is fresh, but not mint ;0)

Regarding python, usually I pip install as a normal user. I am not quite sure what then gets precedence here... mcstas will call the system installed package, right ? Or does it inherit from the user calling mcgui?


I am now running mcstas 2.7.1 from ppa and actually cannot find execute mcrun as such:

    jfmoulin at jfm17:~$ mcrun --write-user-config

    Command 'mcrun' not found, did you mean:

      command 'crun' from deb crun (0.12.1+dfsg-1)
      command 'mcron' from deb mcron (1.0.8-1build1)

    Try: sudo apt install <deb name>


mcrun.pl is actually found at usr/bin/mcrun.pl though. Link missing?


Cheers,


Jean-François


On 3/24/22 09:31, Peter Kjær Willendrup wrote:
Dear Jean-Francois,


OK, thank you for the information.

Which exact Linux Mint are you on? As I remember Mint is a Debian-variant - and was our Debian packages your method of installation? In this situation, the dependencies are assumed to be resolved using Python modules provided by the OS itself, not conda or pip.

The problem seems to relate to problems in the scintilla-based editor, which version of libqscintilla is installed?

What I get on a Ubuntu 20.04 LTS (from the OS, not pip) is
ii  libqscintilla2-qt5-15   2.11.2+dfsg-6 amd64        Qt5 port of the Scintilla source code editing widget


Is your Mint python “in mint condition” ( ;-) ) or has it been enriched with pip-stuff installed at the system level? In the latter case it may be worth checking how the code behaves in a “pure” environment.


Now to a more practical attempt at a solution:

I would try upgrading to 2.7.1 and/or 3.1 which have a new configuration-option in mccode_config.json that allows to avoid using scintilla all together:

mcstas-3.1 env ~ $ mcrun --write-user-config
loading system configuration
userconfig saved to /Users/pkwi/.mcstas/3.1/mccode_config.json

and then edit mccode_config.json so that

    "QSCI": “0"

This should avoid any reference to the qscintilla lib and widgets.


Best and let me know how it goes,

Peter


On 23 Mar 2022, at 13.16, Jean-Francois Moulin <jean-francois.moulin at hereon.de<mailto:jean-francois.moulin at hereon.de>> wrote:



Hello,


I just tried a fresh install of mcstas on a linux mint box and could not start mcgui. The backtrace seems to point to a conflict with the installed pyqt5:


Original exception was:
Traceback (most recent call last):
  File "/usr/share/mcstas/2.7.1/bin/../tools/Python/mcgui/mcgui.py", line 945, in <module>
    main()
  File "/usr/share/mcstas/2.7.1/bin/../tools/Python/mcgui/mcgui.py", line 935, in main
    mcguiApp.ctr = McGuiAppController()
  File "/usr/share/mcstas/2.7.1/bin/../tools/Python/mcgui/mcgui.py", line 417, in __init__
    self.view = McView()
  File "/usr/share/mcstas/2.7.1/tools/Python/mcgui/viewclasses.py", line 23, in __init__
    self.ew = McCodeEditorWindow()
  File "/usr/share/mcstas/2.7.1/tools/Python/mcgui/viewclasses.py", line 281, in __init__
    self.__initScintilla()
  File "/usr/share/mcstas/2.7.1/tools/Python/mcgui/viewclasses.py", line 471, in __initScintilla
    from PyQt5 import Qsci
ValueError: PyCapsule_GetPointer called with incorrect name



I tried both 2.7 and 3 versions, both show the same behaviour.


For Info, pip3 list returns the following

PyQt5                                5.15.6
PyQt5-Qt5                         5.15.2
PyQt5-sip                          12.9.1


Any help appreciated!

Jean-François




Bitte beachten Sie: Die Helmholtz-Zentrum Geesthacht - Zentrum für Material- und Küstenforschung GmbH hat sich am 31.03.2021 in Helmholtz-Zentrum hereon GmbH umbenannt. Informationen dazu finden Sie unter www.hereon.de/name<http://www.hereon.de/name> <https://www.hereon.de/name>

Please note: Since the 31st of March 2021 the Helmholtz-Zentrum Geesthacht – Center for Materials and Coastal Research has a new name: Helmholtz-Zentrum hereon GmbH. More information www.hereon.de/rebranding<http://www.hereon.de/rebranding> <https://www.hereon.de/rebranding>

------------------------------------------------------------------------------
Helmholtz-Zentrum hereon GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführung I Board of Management: Prof. Dr. Matthias Rehahn, Silke Simon
Vorsitzender des Aufsichtsrates I Chairman of the Supervisory Board: Ministerialdirigent Engelbert Beyer
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: www.hereon.de<http://www.hereon.de/> <https://www.hereon.de<https://www.hereon.de/>>
_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users


--
Dr. Jean-François Moulin
German Engineering Materials Science Centre (GEMS)
at Heinz Maier-Leibnitz Zentrum (MLZ)
Helmholtz-Zentrum Hereon
Lichtenbergstr. 1, 85747 Garching bei München, Germany
phone: +49-89-158860-762; email: jean-francois.moulin at hereon.de<mailto:jean-francois.moulin at hereon.de>


Bitte beachten Sie: Die Helmholtz-Zentrum Geesthacht - Zentrum für Material- und Küstenforschung GmbH hat sich am 31.03.2021 in Helmholtz-Zentrum hereon GmbH umbenannt. Informationen dazu finden Sie unter www.hereon.de/name<https://www.hereon.de/name>

Please note: Since the 31st of March 2021 the Helmholtz-Zentrum Geesthacht – Center for Materials and Coastal Research has a new name: Helmholtz-Zentrum hereon GmbH. More information www.hereon.de/rebranding<https://www.hereon.de/rebranding>
________________________________
Helmholtz-Zentrum hereon GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführung I Board of Management: Prof. Dr. Matthias Rehahn, Silke Simon
Vorsitzender des Aufsichtsrates I Chairman of the Supervisory Board: Ministerialdirigent Engelbert Beyer
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: www.hereon.de<https://www.hereon.de/>



--
Dr. Jean-François Moulin
German Engineering Materials Science Centre (GEMS)
at Heinz Maier-Leibnitz Zentrum (MLZ)
Helmholtz-Zentrum Hereon
Lichtenbergstr. 1, 85747 Garching bei München, Germany
phone: +49-89-158860-762; email: jean-francois.moulin at hereon.de<mailto:jean-francois.moulin at hereon.de>


Bitte beachten Sie: Die Helmholtz-Zentrum Geesthacht - Zentrum für Material- und Küstenforschung GmbH hat sich am 31.03.2021 in Helmholtz-Zentrum hereon GmbH umbenannt. Informationen dazu finden Sie unter www.hereon.de/name<https://www.hereon.de/name>

Please note: Since the 31st of March 2021 the Helmholtz-Zentrum Geesthacht – Center for Materials and Coastal Research has a new name: Helmholtz-Zentrum hereon GmbH. More information www.hereon.de/rebranding<https://www.hereon.de/rebranding>
________________________________
Helmholtz-Zentrum hereon GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführung I Board of Management: Prof. Dr. Matthias Rehahn, Silke Simon
Vorsitzender des Aufsichtsrates I Chairman of the Supervisory Board: Ministerialdirigent Engelbert Beyer
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: www.hereon.de<https://www.hereon.de/>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20220324/d8fb1b79/attachment-0001.html>


More information about the mcstas-users mailing list