fast-aircraft-design / FAST-OAD

FAST-OAD: An open source framework for rapid Overall Aircraft Design
GNU General Public License v3.0
51 stars 25 forks source link

Variable Viewer not displaying #358

Closed LucasRmnd closed 3 years ago

LucasRmnd commented 3 years ago

Describe the bug When launching a jupyter notebook all the cells work fine except for the call of the variable viewer. The cell executes properly (no error) but nothing is displayed.

To Reproduce After launching Pycharm, create a new project with a new conda environment. Install FASTOAD using the command $ pip install --upgrade fast-oad. Use the command $ fastoad notebooks. Launch "01_tutorial.ipynb". Get a kernel error. Solve this error by using the command $ conda install pywin32. Relaunch the notebooks and execute it until the variable viewer cell.

Expected behavior The variable viewer should be displayed as showed in the gif in cell "CeRAS for 800nm range".

Error message No error message.

Environment

Additional context Pycharm is launched manually. The anaconda navigator cannot used on the computer. When launched from anaconda navigator on a different computer, with Pycharm 2020.2.3 the same kernel error occurs but the variable viewer displays properly.

ScottDelbecq commented 3 years ago

Do you have the same behaviour with a simple ipywidget?:

import ipywidgets as widgets

widgets.IntSlider(
    value=7,
    min=0,
    max=10,
    step=1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='d'
)
LucasRmnd commented 3 years ago

Do you have the same behaviour with a simple ipywidget?:

import ipywidgets as widgets

widgets.IntSlider(
    value=7,
    min=0,
    max=10,
    step=1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='d'
)

The widget is generated and displays properly with this code. But VariableViewer in the same notebook doesn't work.

After further research, it appears that running the command api_cs25.variable_viewer(xml_file_path) returns a None type object.

LucasRmnd commented 3 years ago

I launched a pytest on test_mdo_process.py (attached) with the .xml file beechcraft_76.xml (also attached). The test passed so there are no errors a priori but I get this message :

VBox(children=(HBox(children=(Button(description='Load', icon='upload', style=ButtonStyle(), tooltip='Load the file'), Button(description='Save', icon='save', style=ButtonStyle(), tooltip='Save to the file'))), HBox(children=(VBox(children=(Label(value='I/O'), Dropdown(layout=Layout(width='auto'), options=('--ALL--', 'Inputs', 'Outputs'), value='--ALL--'))), VBox(children=(Label(value='Variable name'), HBox(children=(Dropdown(options=('data',), value='data'), Dropdown(options=('TLAR',), value='TLAR'), Dropdown(options=('--ALL--', 'NPAX_design', 'category', 'level', 'luggage_mass_design', 'range', 'v_approach', 'v_cruise', 'v_limit', 'v_max_sl'), value='--ALL--'))))))), Sheet(cells=(Cell(column_end=0, column_start=0, numeric_format=None, read_only=True, row_end=8, row_start=0, squeeze_row=False, type='text', value=['data:TLAR:NPAX_design', 'data:TLAR:luggage_mass_design', 'data:TLAR:range', 'data:TLAR:v_approach', 'data:TLAR:v_cruise', 'data:TLAR:v_limit', 'data:TLAR:v_max_sl', 'data:TLAR:level', 'data:TLAR:category']), Cell(column_end=1, column_start=1, row_end=8, row_start=0, squeeze_row=False, type='numeric', value=[2.0, 40.0, 800.0, 78.0, 164.0, 192.0, 171.0, 2.0, 3.0]), Cell(column_end=2, column_start=2, numeric_format=None, read_only=True, row_end=8, row_start=0, squeeze_row=False, type='text', value=[None, 'kg', 'NM', 'kn', 'kn', 'kn', 'kn', None, None]), Cell(column_end=3, column_start=3, numeric_format=None, read_only=True, row_end=8, row_start=0, squeeze_row=False, type='text', value=['', '', 'top-level requirement: design range', '', '', '', '', '', '']), Cell(numeric_format=None, read_only=True, row_end=8, row_start=0, squeeze_row=False, type='text', value=['N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'])), column_headers=['Name', 'Value', 'Unit', 'Description', 'I/O'], column_width=[150, 50, 20, 150], columns=5, layout=Layout(height='400px', width='auto'), row_headers=['0', '1', '2', '3', '4', '5', '6', '7', '8'], rows=9)))

This is a similar message as one I used to get on the notebook but after looking at https://ipywidgets.readthedocs.io/en/latest/user_install.html and trying to solve the issue the message disappeared. Note that all the solutions proposed in this link have been tried and had no effect except for removing the Vbox message in the notebook. It seems that the problem comes from some javascript widgets that do not load as expected.

Attached.zip

christophe-david commented 3 years ago

First things first:

LucasRmnd commented 3 years ago

I am using Jupyter Notebook. Here is the list of the installed packages and their version :

aenum==3.1.0 alabaster==0.7.12 appdirs==1.4.4 argon2-cffi==20.1.0 astroid==2.5.6 async-generator==1.10 atomicwrites==1.4.0 attrs==21.2.0 Babel==2.9.1 backcall==0.2.0 black==19.10b0 bleach==3.3.0 CacheControl==0.12.6 cachy==0.3.0 certifi==2020.12.5 cffi==1.14.5 cfgv==3.3.0 chardet==4.0.0 cleo==0.8.1 click==8.0.1 clikit==0.6.2 colorama==0.4.4 coverage==5.5 crashtest==0.3.1 cycler==0.10.0 decorator==4.4.2 defusedxml==0.7.1 distlib==0.3.2 docutils==0.16 ensure==1.0.0 entrypoints==0.3 fast-oad==1.0.4 fastga==0.1.0 filelock==3.0.12 html5lib==1.1 identify==2.2.10 idna==2.10 imagesize==1.2.0 iniconfig==1.1.1 iPOPO==1.0.1 ipykernel==5.5.5 ipysheet==0.4.4 ipython==7.24.1 ipython-genutils==0.2.0 ipywidgets==7.5.0 isort==5.8.0 jedi==0.18.0 Jinja2==3.0.1 json5==0.9.5 jsonrpclib-pelix==0.4.2 jsonschema==3.2.0 jupyter-client==6.2.0 jupyter-core==4.7.1 jupyterlab==2.3.1 jupyterlab-pygments==0.1.2 jupyterlab-server==1.2.0 jupyterlab-widgets==1.0.0 keyring==21.8.0 kiwisolver==1.3.1 latexcodec==2.0.1 lazy-object-proxy==1.6.0 lockfile==0.12.2 lxml==4.6.3 MarkupSafe==2.0.1 matplotlib==3.4.2 matplotlib-inline==0.1.2 mccabe==0.6.1 mistune==0.8.4 more-itertools==8.8.0 msgpack==1.0.2 nbclient==0.5.3 nbconvert==6.0.7 nbformat==5.1.3 nbval==0.9.6 nest-asyncio==1.5.1 networkx==2.5.1 nodeenv==1.6.0 notebook==6.4.0 numpy==1.20.3 openmdao==3.9.2 openmdao-extensions==1.0.2 packaging==20.9 pandas==1.1.5 pandocfilters==1.4.3 parso==0.8.2 pastel==0.2.1 pathspec==0.8.1 pickleshare==0.7.5 Pillow==8.2.0 pip==21.1.2 pkginfo==1.7.0 plotly==4.14.3 pluggy==0.13.1 poetry==1.1.6 poetry-core==1.0.3 pre-commit==2.13.0 prometheus-client==0.11.0 prompt-toolkit==3.0.18 py==1.10.0 pybtex==0.24.0 pybtex-docutils==1.0.0 pycparser==2.20 pyDOE2==1.3.0 Pygments==2.9.0 pylev==1.4.0 pylint==2.8.3 pyparsing==2.4.7 PyQt5==5.12 PyQtWebEngine==5.12 pyrsistent==0.17.3 pytest==5.4.3 pytest-cov==2.12.1 python-dateutil==2.8.1 pytz==2021.1 pywin32==301 pywin32-ctypes==0.2.0 pywinpty==1.1.2 PyYAML==5.4.1 pyzmq==22.1.0 regex==2021.4.4 requests==2.25.1 requests-toolbelt==0.9.1 retrying==1.3.3 ruamel.yaml==0.17.9 ruamel.yaml.clib==0.2.2 scipy==1.6.1 Send2Trash==1.5.0 setuptools==54.2.0 shellingham==1.4.0 six==1.16.0 snowballstemmer==2.1.0 Sphinx==4.0.2 sphinx-rtd-theme==0.5.2 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-bibtex==2.3.0 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 strictyaml==1.4.0 tabulate==0.8.9 terminado==0.10.1 testpath==0.5.0 toml==0.10.2 tomlkit==0.7.2 tornado==6.1 traitlets==5.0.5 typed-ast==1.4.3 urllib3==1.26.5 virtualenv==20.4.7 wcwidth==0.2.5 webencodings==0.5.1 wheel==0.36.2 widgetsnbextension==3.5.1 wincertstore==0.2 wop==1.13.1 wrapt==1.12.1 xdsmjs==1.0.1

christophe-david commented 3 years ago

Thank you for the list. Indeed, it should work with jupyter notebook, so we will have to inspect that in-depth. As this problem looks very specific, I guess we will have to ask you for additional info/test. Stay tuned...

LucasRmnd commented 3 years ago

It appears that the issue comes from the use of a conda virtual environment.

I created a new python virtual environment and chose the python base interpreter. Then I installed FAST-OAD by following the same procedure as specified in my issue declaration.

The VariableViewer is now displayed when called.