bluesky icon indicating copy to clipboard operation
bluesky copied to clipboard

pyopengl problems

Open DRKWang opened this issue 1 year ago • 13 comments

Hi Joost,

I followed the source installation instruction to try to install the latest version, 2022-07-19, but failed to start it properly. 3 different computer systems were used for installation: Ubuntu 20.04.4 LTS with intel chip, MacOS with M1 chip, MacOS with Intel chip, and all failed. I believe it should be caused by different versions of pyopengl, but have no idea how to fix it. It would be helpful if you can provide which version of packages you used for release.

Here are Ubuntu's logfiles,

(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator$ git clone https://github.com/DRKWang/bluesky.git
Cloning into 'bluesky'...
remote: Enumerating objects: 17747, done.
remote: Counting objects: 100% (319/319), done.
remote: Compressing objects: 100% (206/206), done.
remote: Total 17747 (delta 169), reused 247 (delta 113), pack-reused 17428
Receiving objects: 100% (17747/17747), 127.95 MiB | 11.01 MiB/s, done.
Resolving deltas: 100% (12591/12591), done.
(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator$ ls
bluesky  main.py  venv
(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator$ cd bluesky/
(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator/bluesky$ ls
bluesky            check.py             docs     Makefile     README.md             run-a-scenario-on-windows-from-commandline.bat  scenario   setup-python.bat
BlueSky.py         comm_data_types.rtf  extra    MANIFEST.in  requirements-gui.txt  run-client-on-windows.bat                       setup.cfg  setup-python.errors.then.readme.txt
BlueSky_pygame.py  data                 LICENSE  plugins      requirements.txt      run-headless-on-windows.bat                     setup.py   utils
(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator/bluesky$ pip install -r requirements-gui.txt
Collecting PyQt6
  Downloading PyQt6-6.3.1-cp37-abi3-manylinux1_x86_64.whl (7.8 MB)
     |████████████████████████████████| 7.8 MB 11.2 MB/s            
Collecting PyQt6-WebEngine
  Downloading PyQt6_WebEngine-6.3.1-cp37-abi3-manylinux1_x86_64.whl (242 kB)
     |████████████████████████████████| 242 kB 10.9 MB/s            
Collecting pygame
  Using cached pygame-2.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.8 MB)
Collecting pyopengl
  Using cached PyOpenGL-3.1.6-py3-none-any.whl (2.4 MB)
Collecting numpy
  Using cached numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
Collecting scipy
  Using cached scipy-1.7.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (38.1 MB)
Collecting pandas
  Using cached pandas-1.3.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB)
Collecting matplotlib
  Using cached matplotlib-3.5.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.2 MB)
Collecting msgpack
  Using cached msgpack-1.0.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (299 kB)
Collecting zmq
  Using cached zmq-0.0.0-py3-none-any.whl
Collecting textual
  Downloading textual-0.1.18-py3-none-any.whl (89 kB)
     |████████████████████████████████| 89 kB 4.4 MB/s             
Collecting PyQt6-sip<14,>=13.4
  Downloading PyQt6_sip-13.4.0-cp37-cp37m-manylinux1_x86_64.whl (303 kB)
     |████████████████████████████████| 303 kB 11.0 MB/s            
Collecting PyQt6-Qt6>=6.3.0
  Downloading PyQt6_Qt6-6.3.1-py3-none-manylinux_2_28_x86_64.whl (52.4 MB)
     |████████████████████████████████| 52.4 MB 12.5 MB/s            
Collecting PyQt6-WebEngine-Qt6>=6.3.0
  Downloading PyQt6_WebEngine_Qt6-6.3.1-py3-none-manylinux_2_28_x86_64.whl (98.7 MB)
     |████████████████████████████████| 98.7 MB 12.2 MB/s            
Collecting python-dateutil>=2.7.3
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pytz>=2017.3
  Using cached pytz-2022.1-py2.py3-none-any.whl (503 kB)
Collecting pillow>=6.2.0
  Using cached Pillow-9.2.0-cp37-cp37m-manylinux_2_28_x86_64.whl (3.2 MB)
Collecting fonttools>=4.22.0
  Using cached fonttools-4.34.4-py3-none-any.whl (944 kB)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting packaging>=20.0
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting pyparsing>=2.2.1
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.4.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1> docker-compose build
 MB)
Collecting pyzmq
  Using cached pyzmq-23.2.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB)
Collecting typing-extensions<5.0,>=4.0.0
  Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting rich<13.0.0,>=12.3.0
  Downloading rich-12.5.1-py3-none-any.whl (235 kB)
     |████████████████████████████████| 235 kB 10.9 MB/s            
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting commonmark<0.10.0,>=0.9.0
  Downloading commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
     |████████████████████████████████| 51 kB 8.9 MB/s             
Collecting pygments<3.0.0,>=2.6.0
  Using cached Pygments-2.12.0-py3-none-any.whl (1.1 MB)
Installing collected packages: typing-extensions, six, PyQt6-sip, PyQt6-Qt6, pyparsing, pygments, commonmark, rich, pyzmq, pytz, python-dateutil, PyQt6-WebEngine-Qt6, PyQt6, pillow, packaging, numpy, kiwisolver, fonttools, cycler, zmq, textual, scipy, PyQt6-WebEngine, pyopengl, pygame, pandas, msgpack, matplotlib
Successfully installed PyQt6-6.3.1 PyQt6-Qt6-6.3.1 PyQt6-WebEngine-6.3.1 PyQt6-WebEngine-Qt6-6.3.1 PyQt6-sip-13.4.0 commonmark-0.9.1 cycler-0.11.0 fonttools-4.34.4 kiwisolver-1.4.4 matplotlib-3.5.2 msgpack-1.0.4 numpy-1.21.6 packaging-21.3 pandas-1.3.5 pillow-9.2.0 pygame-2.1.2 pygments-2.12.0 pyopengl-3.1.6 pyparsing-3.0.9 python-dateutil-2.8.2 pytz-2022.1 pyzmq-23.2.0 rich-12.5.1 scipy-1.7.3 six-1.16.0 textual-0.1.18 typing-extensions-4.3.0 zmq-0.0.0
WARNING: You are using pip version 21.3.1; however, version 22.2 is available.
You should consider upgrading via the '/home/derekwang/PycharmProject/Bluesky_simulator/venv/bin/python -m pip install --upgrade pip' command.
(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator/bluesky$ python3 check.py 
This script checks the availability of the libraries required by BlueSky, and the capabilities of your system.

Checking for numpy               [OK]
Checking for scipy               [OK]
Checking for matplotlib          [OK]
Checking for pyqt                [QT 6.3.1]
Checking for pyopengl            [OK]
OpenGL module version is         [3.1.6]
Checking GL capabilities         Traceback (most recent call last):
  File "check.py", line 73, in <module>
    if not QGLFormat.hasOpenGL():
AttributeError: type object 'QSurfaceFormat' has no attribute 'hasOpenGL'
(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator/bluesky$ python3 BlueSky.py 
Using Python-based geo functions
Reading config from settings.cfg
Traceback (most recent call last):
  File "BlueSky.py", line 12, in <module>
    sys.exit(main())
  File "/home/derekwang/PycharmProject/Bluesky_simulator/bluesky/bluesky/__main__.py", line 35, in main
    bs.init(**args)
  File "/home/derekwang/PycharmProject/Bluesky_simulator/bluesky/bluesky/__init__.py", line 63, in init
    settings.init(configfile)
  File "/home/derekwang/PycharmProject/Bluesky_simulator/bluesky/bluesky/settings.py", line 51, in init
    exec(compile(open(cfgfile).read().replace('\\', '/'), cfgfile, 'exec'), globals())
FileNotFoundError: [Errno 2] No such file or directory: 'settings.cfg'

DRKWang avatar Jul 25 '22 13:07 DRKWang

Hi @DRKWang,

It looks like there are multiple things happening. The opengl error could be a qt5/qt6 error, we started with qt6 recently, but perhaps there is still an inconsistency in check.py. There's also an error relating to settings.cfg. Could be related to never having started bluesky before, or recent commits relating to path handling and settings.

jooste avatar Jul 26 '22 15:07 jooste

Hi @DRKWang,

It looks like there are multiple things happening. The opengl error could be a qt5/qt6 error, we started with qt6 recently, but perhaps there is still an inconsistency in check.py. There's also an error relating to settings.cfg. Could be related to never having started bluesky before, or recent commits relating to path handling and settings.

Yes, I think so. There could be a lot of work to check legacy issues and compatibility issues. It could be painful. I think it may be caused by Qt6, since I could install it with pip3 install "Bluesky[qt5]" properly, but qt6 was not. Currently, I am using an old version, 2021, from my friends, which works fine on my computer. But I still hope to get opportunities to try your recently published version. I think it would be helpful if you can provide me with which version of the packages you used for installation, which can be found by $pip3 list and $python3 --version. Appreciated!

DRKWang avatar Jul 26 '22 15:07 DRKWang

I don't have access to my computer in the coming weeks, but perhaps @amorfinv can help you? He's on a mac.

jooste avatar Jul 26 '22 16:07 jooste

You can already safely skip the gl error in check.py. It turns out QGLFormat was already deprecated in Qt5 😉 That leaves the missing settings.cfg. This file should be generated the first time you start BlueSky. There have been quite a few changes to ao settings.py, so it could be that proper functioning got broken on one or more platforms.

jooste avatar Jul 26 '22 16:07 jooste

Hey @jooste @DRKWang ,

Yeah I was trying to see if there is another way to to do the QGLFormat check with Qt6. Unsure how yet.


I just created a fresh environment on mac m1 and I am still able to run the latest bluesky with python 3.10 installed with miniforge.

Once I had python installed I did python -m pip install -r requirements-gui.txt

If I do a pip list I get:

Package             Version
------------------- -------
commonmark          0.9.1
cycler              0.11.0
fonttools           4.34.4
kiwisolver          1.4.4
matplotlib          3.5.2
msgpack             1.0.4
numpy               1.23.1
packaging           21.3
pandas              1.4.3
Pillow              9.2.0
pip                 22.2
pygame              2.1.2
Pygments            2.12.0
PyOpenGL            3.1.6
pyparsing           3.0.9
PyQt6               6.3.1
PyQt6-Qt6           6.3.1
PyQt6-sip           13.4.0
PyQt6-WebEngine     6.3.1
PyQt6-WebEngine-Qt6 6.3.1
python-dateutil     2.8.2
pytz                2022.1
pyzmq               23.2.0
rich                12.5.1
scipy               1.8.1
setuptools          63.2.0
six                 1.16.0
textual             0.1.18
wheel               0.37.1
zmq                 0.0.0

I don't think your issue @DRKWang is related to the environment and is related to the fact that bluesky can't find settings.cfg. There seems to be a bug creating settings.cfg file. When I have the config file in the folder then BlueSky runs fine. However, when I remove it, I get the same error as you.

for a quick fix just create a settings.cfg and place it in the root folder. put the following information in the file and modify as needed.

# Network ports used by BlueSky
event_port=11000
stream_port=11001
simevent_port=12000
simstream_port=12001

# Select the performance model. options: 'openap', 'bada', 'legacy'
performance_model = 'openap'

# Verbose internal logging
verbose = False

# Indicate the logfile path
log_path = 'output'

# Indicate the scenario path
scenario_path = 'scenario'

# Indicate the root data path
data_path = 'data'

# Indicate the graphics data path
gfx_path = 'data/graphics'

# Indicate the path for cache data
cache_path = 'data/cache'

# Indicate the path for navigation data
navdata_path = 'data/navdata'

# Indicate the path for the aircraft performance data
perf_path = 'data/performance'

# Indicate the path for the BADA aircraft performance data (leave empty if BADA is not available)
perf_path_bada = 'data/performance/BADA'

# Indicate the plugins path
plugin_path = 'plugins'

# Specify a list of plugins that need to be enabled by default
enabled_plugins = ['area', 'datafeed']

# Indicate the start location of the radar screen (e.g. [lat, lon], or airport ICAO code)
start_location = 'EHAM'

# Simulation timestep [seconds]
simdt = 0.05

# Performance timestep [seconds]
performance_dt = 1.0

# FMS timestep [seconds]
fms_dt = 1.0

# Prefer compiled BlueSky modules (cgeo, casas)
prefer_compiled = True

# Limit the max number of cpu nodes for parallel simulation
max_nnodes = 999

#=========================================================================
#=  ASAS default settings
#=========================================================================

# ASAS lookahead time [sec]
asas_dtlookahead = 300.0

# ASAS update interval [sec]
asas_dt = 1.0

# ASAS horizontal PZ margin [nm]
asas_pzr = 5.0

# ASAS vertical PZ margin [ft]
asas_pzh = 1000.0

# ASAS factors applied on protected zone for resolution horizontally and vertically [-]
asas_marh = 1.05
asas_marv = 1.05
#=============================================================================
#=   QTGL Gui specific settings below
#=   Pygame Gui options in /data/graphics/scr_cfg.dat
#=============================================================================

# Radarscreen font size in pixels
text_size = 13

# Radarscreen airport symbol size in pixels
apt_size = 10

# Radarscreen waypoint symbol size in pixels
wpt_size = 10

# Radarscreen aircraft symbol size in pixels
ac_size = 16

# Stack and command line text color
stack_text_color = 0, 255, 0

# Stack and command line background color
stack_background_color = 102, 102, 102

In the meantime I will try to figure out why it is not creating a settings.cfg file.

amorfinv avatar Jul 26 '22 17:07 amorfinv

Hopefully will get fixed in #405.

-Andres

amorfinv avatar Jul 26 '22 17:07 amorfinv

Thanks a lot @jooste and @amorfinv

DRKWang avatar Jul 26 '22 17:07 DRKWang

Hi @amorfinv, I reinstalled it from the source and added a settings.cfg file as you suggested, and also skipped the check procedure, but it still has some issues. The error is as follows:

(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator_Latest/bluesky$ python3 BlueSky.py 
Using Python-based geo functions
Reading config from settings.cfg
Reading magnetic variation data
Loading global navigation database...
Cachefile not found: /home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/data/cache/navdata.p
Reading nav.dat
Reading fix.dat
Reading awy.dat
Reading apt.dat from apt.zip
Traceback (most recent call last):
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/navdatabase/loadnavdata.py", line 23, in load_navdata
    wptdata       = cache.load()
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/tools/cachefile.py", line 44, in load
    self.check_cache()
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/tools/cachefile.py", line 29, in check_cache
    raise CacheError('Cachefile not found: ' + str(self.fname))
bluesky.tools.cachefile.CacheError: Cachefile not found: /home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/data/cache/navdata.p

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/BlueSky.py", line 12, in <module>
    sys.exit(main())
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/__main__.py", line 35, in main
    bs.init(**args)
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/__init__.py", line 73, in init
    navdb = Navdatabase()
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/navdatabase/navdatabase.py", line 45, in __init__
    self.reset()
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/navdatabase/navdatabase.py", line 49, in reset
    wptdata, aptdata, awydata, firdata, codata, rwythresholds = load_navdata()
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/navdatabase/loadnavdata.py", line 35, in load_navdata
    cache.dump(wptdata)
  File "/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/bluesky/tools/cachefile.py", line 51, in dump
    self.file = open(self.fname, 'wb')
FileNotFoundError: [Errno 2] No such file or directory: '/home/derekwang/PycharmProject/Bluesky_simulator_Latest/bluesky/data/cache/navdata.p'

I used python3.10 to run and also checked the versions of packages, which are almost the same as the versions that you post, which indicates that it probably is not caused by the version issues.

Here are the results from pip3 list on my computer:

(venv) derekwang@tide:~/PycharmProject/Bluesky_simulator_Latest/bluesky$ pip3 list
Package             Version
------------------- -------
commonmark          0.9.1
cycler              0.11.0
fonttools           4.34.4
kiwisolver          1.4.4
matplotlib          3.5.2
msgpack             1.0.4
numpy               1.23.1
packaging           21.3
pandas              1.4.3
Pillow              9.2.0
pip                 21.3.1
pygame              2.1.2
Pygments            2.12.0
PyOpenGL            3.1.6
pyparsing           3.0.9
PyQt6               6.3.1
PyQt6-Qt6           6.3.1
PyQt6-sip           13.4.0
PyQt6-WebEngine     6.3.1
PyQt6-WebEngine-Qt6 6.3.1
python-dateutil     2.8.2
pytz                2022.1
pyzmq               23.2.0
rich                12.5.1
scipy               1.8.1
setuptools          60.2.0
six                 1.16.0
textual             0.1.18
wheel               0.37.1
zmq                 0.0.0

DRKWang avatar Jul 26 '22 18:07 DRKWang

You can already safely skip the gl error in check.py. It turns out QGLFormat was already deprecated in Qt5 wink That leaves the missing settings.cfg. This file should be generated the first time you start BlueSky. There have been quite a few changes to ao settings.py, so it could be that proper functioning got broken on one or more platforms.

Good to know that "QGLFormat" has been deprecated. Lol

DRKWang avatar Jul 26 '22 18:07 DRKWang

@DRKWang I will update the pull request #405 to fix this issue as well

BlueSky is expecting the directory data/cache and it is not there because the start-up script fails to create it. make the following directories and I think it should work:

  • data/cache
  • output

amorfinv avatar Jul 26 '22 18:07 amorfinv

@DRKWang I will update the pull request #405 to fix this issue as well

BlueSky is expecting the directory data/cache and it is not there because the start-up script fails to create it. make the following directories and I think it should work:

  • data/cache
  • output

I see. Thanks!

DRKWang avatar Jul 26 '22 18:07 DRKWang

Ah, this is all caused by the change in settings.py which made the creation of cache dir and settings.cfg only for packaged bluesky. @amorfinv 's fix is halfway there.

jooste avatar Jul 26 '22 19:07 jooste

@DRKWang I will update the pull request #405 to fix this issue as well BlueSky is expecting the directory data/cache and it is not there because the start-up script fails to create it. make the following directories and I think it should work:

  • data/cache
  • output

I see. Thanks!

@DRKWang this issue related to settings.py should get fixed with #406.

amorfinv avatar Jul 27 '22 09:07 amorfinv