TUDelft-CNS-ATM / bluesky

The open source air traffic simulator
GNU General Public License v3.0
374 stars 249 forks source link

PyQt5 passes checks but simulator still crashes #71

Closed espinielli closed 7 years ago

espinielli commented 7 years ago

I installed as per instructions. I run the checks and then the applications, got a brief dialog with some QEGLPlatformContext: eglError 3005 ... error message than the application crashed. Here is the output:

C:\repos\bluesky>python check.py
checking for pyqt, OK: PyQt4 found.
checking for pyopengl, OK.
checking for pygame, OK.
checking for scipy, OK.
checking for numpy, OK.
checking for matplotlib, OK.
checking bluesky modules
Using Qt5 for windows and widgets
Cool! all modules good to go!

C:\repos\bluesky>python BlueSky.py
   *****   BlueSky Open ATM simulator *****
Distributed under GNU General Public License v3
Reading config from settings.cfg
Using Qt5 for windows and widgets
Using BADA performance model. Found 195 aircraft performance definition files (*.OPF)
Initializing multi-process simulation
QGLWidget initialized for OpenGL version 3.3
Loading global navigation database...
Reading cache: navdata.p
Reading cache: rwythresholds.p
Reading cache: aptsurface.p
Reading config from settings.cfg
Using BADA performance model. Found 195 aircraft performance definition files (*.OPF)
Loading global navigation database...
Reading cache: navdata.p
Traceback (most recent call last):
  File "C:\repos\bluesky\bluesky\ui\qtgl\radarwidget.py", line 160, in actnodeChanged
    self.allpolys.set_vertex_count(len(nact.polydata) / 2)
AttributeError: 'RadarWidget' object has no attribute 'allpolys'

C:\repos\bluesky>Reading cache: rwythresholds.p
Traceback (most recent call last):
  File "BlueSky_qtgl.py", line 84, in <module>
    MainLoop()
  File "BlueSky_qtgl.py", line 45, in MainLoop
    runNode()
  File "C:\repos\bluesky\bluesky\sim\qtgl\nodemanager.py", line 20, in runNode
    manager.sim.doWork()
  File "C:\repos\bluesky\bluesky\sim\qtgl\simulation.py", line 104, in doWork
    stack.process(self, self.traf, self.screenio)
  File "C:\repos\bluesky\bluesky\stack\stack.py", line 1143, in process
    results = function(*arglist)  # * = unpack list to call arguments
  File "C:\repos\bluesky\bluesky\sim\qtgl\screenio.py", line 79, in echo
    self.manager.sendEvent(StackTextEvent(disptext=text))
  File "C:\repos\bluesky\bluesky\sim\qtgl\nodemanager.py", line 56, in sendEvent
    self.connection.send((int(event.type()), event))
IOError: [Errno 10054] An existing connection was forcibly closed by the remote host
jooste commented 7 years ago

Hi Enrico,

There are known GL issues with Intel integrated graphics for 3rd generation core-i processors and earlier. Could this cause your problem, or do you have a different h/w configuration?

espinielli commented 7 years ago

With latest commits now I get something showing up: image

If I aknowledge the first warning, I get a second one:

QEGLPlatformContext::init: eglError: 3005, this: 0x8fa0ab0 

Acknowledging that, and loading a scenario keeps the screen white...

jooste commented 7 years ago

What platform are you running this on? From what I can find, QEGL* is related to OpenGL ES (Embedded Systems), which is specific to devices like smartphones.

espinielli commented 7 years ago

System Model HP EliteBook 840 G1 Processor Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz, 2501 Mhz, 2 Core(s), 4 Logical Processor(s)

No way to get Graphics Card info, no sys admin rights...such is Corporate IT, sigh. Probably used the default things, such as in this brcohure

jooste commented 7 years ago

Ok, you have a 4th generation core-i processor, so even with the integrated graphics BlueSky should work. I am wondering, though, about the OpenGL ES thing. Have you used your current python installation for mobile/tablet development or anything like that? I get the impression that a library is loaded that shouldn't be there.

espinielli commented 7 years ago

No this is on my laptop at work...no mobile/tablet...

jooste commented 7 years ago

A way to test whether something in your python distribution is causing this is to try a bundled Bluesky release, e.g., https://github.com/ProfHoekstra/bluesky/releases/tag/20161201. This release isn't up to date with the latest commits, but if it starts this might tell us a bit more.

jooste commented 7 years ago

Oh, according to the specs brochure your laptop should even have discrete AMD graphics. The GL version of BlueSky should definitely work on your laptop.

espinielli commented 7 years ago

Anything I should check? Traces to be enabled somewhere? (The Qt-based version is certainly prettier)

jooste commented 7 years ago

Well, have you tried installing the bundled version? It comes with its own python and its own libraries. If it gives the exact same problems we have to look elsewhere, but the fact that you get a OpenGL-ES error makes me think that its related to the libs.

espinielli commented 7 years ago

I installed following the instractions...for a colleague of mine: we get the same errors. My machine is wilder, but strangely I have the same errors as a from scratch install.

On Fri, Jan 20, 2017 at 8:26 PM, Joost Ellerbroek notifications@github.com wrote:

Well, have you tried installing the bundled version? It comes with its own python and its own libraries. If it gives the exact same problems we have to look elsewhere, but the fact that you get a OpenGL-ES error makes me think that its related to the libs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ProfHoekstra/bluesky/issues/71#issuecomment-274157735, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2bLFvsZl4eqYiO0l1mvYnaQ1AjmVvsks5rUQpwgaJpZM4LpCTo .

jooste commented 7 years ago

Did you use the python-xy or anaconda bundle, or did you install python manually? I vaguely remember that Qt5 can give problems on windows (works perfectly on mac and linux though). The bundled bluesky installer has a known good combination of libraries, which makes it a good check. You can just uninstall it afterwards. Alternatively you can try to replace pyqt5 with pyqt4, or switch to anaconda/python-xy if you installed your current python manually (of these two bundles, anaconda seems the most active one).

I cannot really think of anything else. When I google for the error code I just get android stuff. Its also just weird that a regular windows installation of python + libs gives you OpenGL ES. This is another benefit of the python bundles (python-xy and anaconda): there at least you know that the libraries are suitable for your platform.

espinielli commented 7 years ago

No bundle...I have a 2.7 version coming from ArcGIS, then followed the instructions on the wiki. On the contrary on OSX I am out of luck with it: tried everything and failed. I'll try your suggestion at work on Windows and give a try w/ Anaconda on my mac at home.

On Fri, Jan 20, 2017 at 10:42 PM, Joost Ellerbroek <notifications@github.com

wrote:

Did you use the python-xy or anaconda bundle, or did you install python manually? I vaguely remember that Qt5 can give problems on windows (works perfectly on mac and linux though). The bundled bluesky installer has a known good combination of libraries, which makes it a good check. You can just uninstall it afterwards. Alternatively you can try to replace pyqt5 with pyqt4, or switch to anaconda/python-xy if you installed your current python manually (of these two bundles, anaconda seems the most active one).

I cannot really think of anything else. When I google for the error code I just get android stuff. Its also just weird that a regular windows installation of python + libs gives you OpenGL ES. This is another benefit of the python bundles (python-xy and anaconda): there at least you know that the libraries are suitable for your platform.

jooste commented 7 years ago

Based on this I think that the first item on the list for revision of the docs on the wiki are the installation instructions! These are the configurations we use most at the moment:

windows: 64-bit Anaconda with pyqt4 and pyopengl >= 3.1.1a1 macos: 64-bit Anaconda with pyqt5 and pyopengl >= 3.1.1a1

espinielli commented 7 years ago

I tried on osx 10.11.6 in a pyenv with python 2.7 and all prereqs, the miniconda instructions failed miserable at PyQt5. I did not find a way to install it.

Could please you post a gist with the exact sequence of commands? Or did you consider building a docker image for bluesky? I really appreciate any help you can provide.

jooste commented 7 years ago

Indeed. I will make detailed installation instructions for mac and windows. A docker image also sounds like a good idea, I'll look into that!

jooste commented 7 years ago

Hi Enrico,

I've updated the installation instructions on the wiki. I've validated them on a windows and a Mac system. Let me know if it also works for you, or if you have other comments!

espinielli commented 7 years ago

No luck. Here is what I did:

  1. Set anaconda up pyenv install anaconda2-4.2.0

  2. Install pyopengl-accelerate as per installation instructions: conda install pyopengl-accelerate It failed as follows:

    ╰─ᐅ conda install pyopengl-accelerate
    Fetching package metadata .......
    Solving package specifications: ..........
    
    Package plan for installation in environment /Users/espin/.pyenv/versions/anaconda2-4.2.0/envs/bluesky:
    
    The following packages will be downloaded:
    
    package                    |            build
    ---------------------------|-----------------
    mkl-2017.0.1               |                0       110.8 MB
    numpy-1.11.3               |           py27_0         3.2 MB
    pyopengl-3.1.1a1           |      np111py27_0         1.0 MB
    pyopengl-accelerate-3.1.1a1|      np111py27_0         156 KB
    ------------------------------------------------------------
                                           Total:       115.2 MB
    
    The following NEW packages will be INSTALLED:
    
    mkl:                 2017.0.1-0
    numpy:               1.11.3-py27_0
    pyopengl:            3.1.1a1-np111py27_0
    pyopengl-accelerate: 3.1.1a1-np111py27_0
    
    Proceed ([y]/n)? y
    
    Fetching packages ...
    mkl-2017.0.1-0  10% |########                        An unexpected error has occurred.                 | ETA:  1:09:45  24.90 kB/s
    Please consider posting the following information to the conda GitHub issue tracker at:
    
    https://github.com/conda/conda/issues
    
    Current conda install:
    
               platform : osx-64
          conda version : 4.2.9
       conda is private : False
      conda-env version : 4.2.9
    conda-build version : 2.0.2
         python version : 2.7.12.final.0
       requests version : 2.11.1
       root environment : /Users/espin/.pyenv/versions/anaconda2-4.2.0  (writable)
    default environment : /Users/espin/.pyenv/versions/anaconda2-4.2.0/envs/bluesky
       envs directories : /Users/espin/.pyenv/versions/anaconda2-4.2.0/envs
          package cache : /Users/espin/.pyenv/versions/anaconda2-4.2.0/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/osx-64/
                          https://repo.continuum.io/pkgs/free/noarch/
                          https://repo.continuum.io/pkgs/pro/osx-64/
                          https://repo.continuum.io/pkgs/pro/noarch/
            config file : None
           offline mode : False
    
    `$ /Users/espin/.pyenv/versions/bluesky/bin/conda install pyopengl-accelerate`
    
    Traceback (most recent call last):
      File "/Users/espin/.pyenv/versions/anaconda2-4.2.0/lib/python2.7/site-packages/conda/exceptions.py", line 473, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/Users/espin/.pyenv/versions/anaconda2-4.2.0/lib/python2.7/site-packages/conda/cli/main.py", line 144, in _main
        exit_code = args.func(args, p)
      File "/Users/espin/.pyenv/versions/anaconda2-4.2.0/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "/Users/espin/.pyenv/versions/anaconda2-4.2.0/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
        raise CondaRuntimeError('RuntimeError: %s' % e)
    CondaRuntimeError: Runtime error: RuntimeError: Runtime error: Could not open u'/Users/espin/.pyenv/versions/anaconda2-4.2.0/pkgs/mkl-2017.0.1-0.tar.bz2.part' for writing (HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out.).

    but this was a problem of umask, so I changed mkl-2017.0.1-0.tar.bz2.part and the default umask to 002 and was able to finish installation.

  3. clone bluesky repo

  4. check runtime environment (after pyenv activate bluesky)

    (bluesky) ╭─~/repos/bluesky (master ✔)
    ╰─ᐅ python check.py
    checking for pyqt, pyqt version 4 or 5 missing. You might still be ok if you want to run the pygame version of BlueSky.
    checking for pyopengl, OK.
    checking for pygame, pygame is missing..
    checking for scipy, scipy is missing..
    checking for numpy, OK.
    checking for matplotlib, matplotlib is missing..
    checking bluesky modules
    Traceback (most recent call last):
      File "check.py", line 60, in <module>
    from bluesky.ui import *
    File "/Volumes/repositories/bluesky/bluesky/ui/__init__.py", line 3, in <module>
    from qtgl import Gui
    File "/Volumes/repositories/bluesky/bluesky/ui/qtgl/__init__.py", line 1, in <module>
    from gui import Gui
    File "/Volumes/repositories/bluesky/bluesky/ui/qtgl/gui.py", line 8, in <module>
    from PyQt4.QtCore import Qt, QEvent, QTimer
    ImportError: No module named PyQt4.QtCore
    
    One or more bluesky modules is not working properly, check error for more detail.

It looks like I have to explicitly install pyqt...did you install it explicitly?

jooste commented 7 years ago

I am not familiar with pyenv, but my guess is that it only installs the bare minimum, as installing pyopengl also still required things like numpy. When you install the full Anaconda bundle you also get pyqt 5.6.0. Lets see if the following gets you all the required packages:

conda install pyqt=5.6.0 scipy matplotlib
espinielli commented 7 years ago

In the meantime I did conda install pyqt

╰─ᐅ conda install pyqt
Fetching package metadata .......
Solving package specifications: ..........

Package plan for installation in environment /Users/espin/.pyenv/versions/anaconda2-4.2.0/envs/bluesky:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    qt-5.6.2                   |                0        67.2 MB
    pyqt-5.6.0                 |           py27_2         4.3 MB
    ------------------------------------------------------------
                                           Total:        71.5 MB

The following NEW packages will be INSTALLED:

    icu:  54.1-0
    pyqt: 5.6.0-py27_2
    qt:   5.6.2-0
    sip:  4.18-py27_0

Proceed ([y]/n)? y

Fetching packages ...
qt-5.6.2-0.tar 100% |##################################################################################| Time: 0:04:53 240.23 kB/s
pyqt-5.6.0-py2 100% |##################################################################################| Time: 0:00:16 271.89 kB/s
Extracting packages ...
[      COMPLETE      ]|#####################################################################################################| 100%
Linking packages ...
[      COMPLETE      ]|#####################################################################################################| 100%

And got scipy and matplotlib missing from the checks:

(bluesky) ╭─~/repos/bluesky (master ✔)
╰─ᐅ python check.py
checking for pyqt, OK: PyQt5 found.
checking for pyopengl, OK.
checking for pygame, pygame is missing..
checking for scipy, scipy is missing..
checking for numpy, OK.
checking for matplotlib, matplotlib is missing..
checking bluesky modules
Using Qt5 for windows and widgets
Traceback (most recent call last):
  File "check.py", line 60, in <module>
    from bluesky.ui import *
  File "/Volumes/repositories/bluesky/bluesky/ui/__init__.py", line 3, in <module>
    from qtgl import Gui
  File "/Volumes/repositories/bluesky/bluesky/ui/qtgl/__init__.py", line 1, in <module>
    from gui import Gui
  File "/Volumes/repositories/bluesky/bluesky/ui/qtgl/gui.py", line 16, in <module>
    from ..radarclick import radarclick
  File "/Volumes/repositories/bluesky/bluesky/ui/radarclick.py", line 3, in <module>
    from ..stack.stack import cmdsynon
  File "/Volumes/repositories/bluesky/bluesky/stack/__init__.py", line 1, in <module>
    from stack import *
  File "/Volumes/repositories/bluesky/bluesky/stack/stack.py", line 25, in <module>
    from ..tools import geo, areafilter
  File "/Volumes/repositories/bluesky/bluesky/tools/areafilter.py", line 3, in <module>
    from matplotlib.path import Path
ImportError: No module named matplotlib.path

One or more bluesky modules is not working properly, check error for more detail.

The I just installed them:

╰─ᐅ conda install scipy matplotlib
Fetching package metadata .......
Solving package specifications: ..........

Package plan for installation in environment /Users/espin/.pyenv/versions/anaconda2-4.2.0/envs/bluesky:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libpng-1.6.27              |                0         240 KB
    freetype-2.5.5             |                2         738 KB
    pytz-2016.10               |           py27_0         181 KB
    python-dateutil-2.6.0      |           py27_0         232 KB
    scipy-0.18.1               |      np111py27_1        13.7 MB
    matplotlib-2.0.0           |      np111py27_0         8.3 MB
    ------------------------------------------------------------
                                           Total:        23.4 MB

The following NEW packages will be INSTALLED:

    cycler:          0.10.0-py27_0
    freetype:        2.5.5-2
    functools32:     3.2.3.2-py27_0
    libpng:          1.6.27-0
    matplotlib:      2.0.0-np111py27_0
    pyparsing:       2.1.4-py27_0
    python-dateutil: 2.6.0-py27_0
    pytz:            2016.10-py27_0
    scipy:           0.18.1-np111py27_1
    six:             1.10.0-py27_0

Proceed ([y]/n)? y

Fetching packages ...
libpng-1.6.27- 100% |##################################################################################| Time: 0:00:00   1.76 MB/s
freetype-2.5.5 100% |##################################################################################| Time: 0:00:02 264.92 kB/s
pytz-2016.10-p 100% |##################################################################################| Time: 0:00:00 268.88 kB/s
python-dateuti 100% |##################################################################################| Time: 0:00:00 318.40 kB/s
scipy-0.18.1-n 100% |##################################################################################| Time: 0:00:54 263.38 kB/s
matplotlib-2.0 100% |##################################################################################| Time: 0:00:36 241.64 kB/s
Extracting packages ...
[      COMPLETE      ]|#####################################################################################################| 100%
Linking packages ...
[      COMPLETE      ]|#####################################################################################################| 100%
(bluesky) ╭─~/repos/bluesky (master ✔)
╰─ᐅ python check.py
checking for pyqt, OK: PyQt5 found.
checking for pyopengl, OK.
checking for pygame, pygame is missing..
checking for scipy, OK.
checking for numpy, OK.
checking for matplotlib, OK.
checking bluesky modules
Using Qt5 for windows and widgets
Using BlueSky performance model
Fontconfig warning: line 146: blank doesn't take any effect anymore. please remove it from your fonts.conf
Cool! all modules good to go!
(bluesky)

And it works like a charm! Thanks.

PS: The reason I use pyenv is the need to have isolated (virtual) environments where to run different versions of python/tools/libraries/...it is not possible for me to install things globally...