titusjan / argos

Argos: a data viewer that can read HDF5, NetCDF4, and other file formats.
GNU General Public License v3.0
176 stars 26 forks source link

argos does not show output when failing to start #1

Closed bilderbuchi closed 7 years ago

bilderbuchi commented 7 years ago

Hi!

This looks very awesome! I just tried installing argos, and seemingly succeeded, but running argos just didn't show anything. I went deeper and found that apparently your main function fails due to some PyQt5 problem, but afaict I followed your instructions, and have no idea how to fix it.

Console output (Windows 10 64bit, and Anaconda)

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. Alle Rechte vorbehalten.

Z:\>conda create -n tryargos python numpy
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment C:\Continuum\Anaconda3\envs\tryargos:

The following NEW packages will be INSTALLED:

    mkl:            2017.0.1-0
    numpy:          1.11.3-py36_0
    pip:            9.0.1-py36_1
    python:         3.6.0-0
    setuptools:     27.2.0-py36_1
    vs2015_runtime: 14.0.25123-0
    wheel:          0.29.0-py36_0

Proceed ([y]/n)?

Linking packages ...
[      COMPLETE      ]|##################################################| 100%
#
# To activate this environment, use:
# > activate tryargos
#
# To deactivate this environment, use:
# > deactivate tryargos
#
# * for power-users using bash, you must source
#

Z:\>activate tryargos

(tryargos) Z:\>pip install PyQt5 pyqtgraph argos
Collecting PyQt5
  Using cached PyQt5-5.7.1-5.7.1-cp34.cp35.cp36-none-win_amd64.whl
Collecting pyqtgraph
Collecting argos
Collecting sip>=4.19 (from PyQt5)
  Using cached sip-4.19-cp36-none-win_amd64.whl
Requirement already satisfied: numpy in c:\continuum\anaconda3\envs\tryargos\lib\site-packages (from pyqtgraph)
Installing collected packages: sip, PyQt5, pyqtgraph, argos
Successfully installed PyQt5-5.7.1 argos-0.2.1 pyqtgraph-0.10.0 sip-4.19

(tryargos) Z:\>argos -h

(tryargos) Z:\>argos

(tryargos) Z:\>python -m argos.main
Traceback (most recent call last):
  File "C:\Continuum\Anaconda3\envs\tryargos\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Continuum\Anaconda3\envs\tryargos\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Continuum\Anaconda3\envs\tryargos\lib\site-packages\argos\main.py", line 200, in <module>
    main()
  File "C:\Continuum\Anaconda3\envs\tryargos\lib\site-packages\argos\main.py", line 186, in main
    from argos.qt.misc import ABOUT_QT_BINDINGS
  File "C:\Continuum\Anaconda3\envs\tryargos\lib\site-packages\argos\qt\__init__.py", line 23, in <module>
    from argos.qt.misc import Qt, QtCore, QtGui, QtWidgets, QtSvg, QtSignal, QtSlot
  File "C:\Continuum\Anaconda3\envs\tryargos\lib\site-packages\argos\qt\misc.py", line 83, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets, QtSvg
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

(tryargos) Z:\>

(The german bit says "the specified module could not be found")

Any ideas what's wrong here? Also, I would have expected that argos does not silently swallow the encountered exception, and would at least log something I can see to even know that something went wrong.

titusjan commented 7 years ago

It seems that there is a problem with your PyQt5 installation. Let's try to confirm this by bypassing Argos and importing PyQt5 directly from Python. Can you try the following command from the shell?

c:\> python -c "from PyQt5 import QtCore, QtGui, QtWidgets, QtSvg"

If you get the same error we are sure that PyQt5 is the culprit.

I noticed that you installed PyQt5 with pip, even though you have anaconda. You could perhaps uninstall from pip and then use conda install pyqt to install PyQt again. I know PyQt 5.7 is not yet available on Anaconda, but 5.6 works fine with Argos.

Also, I would have expected that argos does not silently swallow the encountered exception, and would at least log something I can see to even know that something went wrong.

The Argos installer creates some platform-specific scripts or programs (e.g. the argos.exe) to abstract away some OS differences (see https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation). Unfortunately these scripts swallow the exceptions.

I ran into the same problem, that's why I wrote the trouble shooting section, which you've found. I agree with you that this is undesirable but I don't know how to configures the setup_tools package to create scripts that don't swallow the exceptions. If anybody knows this, please tell me.

bilderbuchi commented 7 years ago

If you get the same error we are sure that PyQt5 is the culprit.

Yes, in the meantime I have confirmed that from PyQt5 import QTCore is the minimum failing example.

use conda install pyqt

Ha, I overlooked that! I had some fears about pyqt4/5 coexistence problems (and need pyqt4 still for matplotlib and friends), so I made a separate environment. Didn't realize I could as well install pyqt that way. Interestingly, conda's pyqtgraph version is currently not new enough, and demands pyqt4 still, so I installed that via pip.

Anyway, it starts now, thank you! Now to wait until the rest of the scientific python ecosystem moves to pyqt5, so I don't need a separate environment. :D

bilderbuchi commented 7 years ago

Regarding your point about the exceptions, in your argos.main.main() you could catch all exceptions (maybe except systemexit et al) and log them to stdout/err using logging.Logger.exception().

titusjan commented 7 years ago

The problem is that argos.exefails before argos.main.main() is even called.