usnistgov / AusteniteCalculator

Software and GUI for uncertainty quantification of austenite phase fraction
Other
1 stars 0 forks source link

No module named 'dash_unload_component' #31

Closed creuzige closed 2 years ago

creuzige commented 2 years ago

Pulled the latest commit (ecbf784) and tried to run the app, but got a "ModuleNotFoundError: No module named 'dash_unload_component' " error. I tried updating my conda environment, thinking that might be the issue but no luck...

Any ideas?

(gsas-AustCalc) PN118888:app creuzige$ python3 app.py 
Traceback (most recent call last):
  File "app.py", line 13, in <module>
    import dash_unload_component as duc
ModuleNotFoundError: No module named 'dash_unload_component'
(gsas-AustCalc) PN118888:app creuzige$ ls
__pycache__         export_file.txt
app.py              fit.py
assets              pytest.ini
austenitecalculator.pdf     testing_data_setup.py
compute_results.py      testing_mandel.py
compute_uncertainties.py
(gsas-AustCalc) PN118888:app creuzige$ cd ..
(gsas-AustCalc) PN118888:AusteniteCalculator creuzige$ ls
Dockerfile      WorkFlowDiagrams    server_datadir
ExampleData     app         server_default_datadir
ExampleScripts      conda_gsas_env.yml  server_workdir
README.md       license.md      sphinx_docs
SaveData        requirements.txt    stan_files
(gsas-AustCalc) PN118888:AusteniteCalculator creuzige$ conda env update gsas-AustCalc --file conda_gsas_env.yml 
Collecting package metadata (repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 4.9.2
  latest version: 4.13.0

Please update conda by running

    $ conda update -n base -c defaults conda

Downloading and Extracting Packages
plotly-5.9.0         | 9.1 MB    | ##################################### | 100% 
sphinx-5.0.2         | 2.1 MB    | ##################################### | 100% 
cmdstanpy-0.9.76     | 42 KB     | ##################################### | 100% 
openssl-1.1.1q       | 3.5 MB    | ##################################### | 100% 
ujson-5.4.0          | 53 KB     | ##################################### | 100% 
pip-22.1.2           | 2.9 MB    | ##################################### | 100% 
pytest-7.1.2         | 459 KB    | ##################################### | 100% 
certifi-2022.6.15    | 157 KB    | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Installing pip dependencies: | Ran pip subprocess with arguments:
['/Users/creuzige/anaconda2/envs/gsas-AustCalc/bin/python', '-m', 'pip', 'install', '-U', '-r', '/Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt']
Pip subprocess output:
Requirement already satisfied: dash-bootstrap-components in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from -r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 1)) (1.1.0)
Collecting dash-bootstrap-components
  Downloading dash_bootstrap_components-1.2.0-py3-none-any.whl (216 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 216.1/216.1 kB 1.1 MB/s eta 0:00:00
Requirement already satisfied: dash-extensions==0.0.71 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from -r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (0.0.71)
Collecting kaleido
  Downloading kaleido-0.2.1-py2.py3-none-macosx_10_11_x86_64.whl (85.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.2/85.2 MB 8.7 MB/s eta 0:00:00
Collecting dash-unload-component
  Downloading dash_unload_component-1.2.2.tar.gz (8.2 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting apscheduler
  Downloading APScheduler-3.9.1-py2.py3-none-any.whl (59 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.5/59.5 kB 1.8 MB/s eta 0:00:00
Requirement already satisfied: Flask-Caching in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (1.10.1)
Requirement already satisfied: dash in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.4.1)
Requirement already satisfied: more-itertools in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (8.13.0)
Requirement already satisfied: jsbeautifier in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (1.14.3)
Requirement already satisfied: pytz in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from apscheduler->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 5)) (2021.3)
Requirement already satisfied: six>=1.4.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from apscheduler->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 5)) (1.16.0)
Requirement already satisfied: setuptools>=0.7 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from apscheduler->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 5)) (61.2.0)
Collecting tzlocal!=3.*,>=2.0
  Downloading tzlocal-4.2-py3-none-any.whl (19 kB)
Requirement already satisfied: plotly>=5.0.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (5.9.0)
Requirement already satisfied: Flask>=1.0.4 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.0.3)
Requirement already satisfied: dash-html-components==2.0.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.0.0)
Requirement already satisfied: dash-core-components==2.0.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.0.0)
Requirement already satisfied: flask-compress in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (1.10.1)
Requirement already satisfied: dash-table==5.0.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (5.0.0)
Collecting pytz-deprecation-shim
  Downloading pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl (15 kB)
Collecting backports.zoneinfo
  Downloading backports.zoneinfo-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl (35 kB)
Requirement already satisfied: editorconfig>=0.12.2 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from jsbeautifier->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (0.12.3)
Requirement already satisfied: itsdangerous>=2.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.0.1)
Requirement already satisfied: click>=7.1.2 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (8.0.4)
Requirement already satisfied: Jinja2>=3.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (3.0.3)
Requirement already satisfied: Werkzeug>=2.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.0.3)
Requirement already satisfied: tenacity>=6.2.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from plotly>=5.0.0->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (8.0.1)
Requirement already satisfied: brotli in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from flask-compress->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (1.0.9)
Collecting tzdata
  Downloading tzdata-2022.1-py2.py3-none-any.whl (339 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 339.5/339.5 kB 6.5 MB/s eta 0:00:00
Requirement already satisfied: importlib-metadata in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from click>=7.1.2->Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (4.11.3)
Requirement already satisfied: MarkupSafe>=2.0 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from Jinja2>=3.0->Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (2.0.1)
Requirement already satisfied: zipp>=0.5 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from importlib-metadata->click>=7.1.2->Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (3.8.0)
Requirement already satisfied: typing-extensions>=3.6.4 in /Users/creuzige/anaconda2/envs/gsas-AustCalc/lib/python3.7/site-packages (from importlib-metadata->click>=7.1.2->Flask>=1.0.4->dash->dash-extensions==0.0.71->-r /Users/creuzige/Documents/NIST_Research/GitHub/AusteniteCalculator/condaenv.r7cjj5mf.requirements.txt (line 2)) (4.1.1)
Building wheels for collected packages: dash-unload-component
  Building wheel for dash-unload-component (setup.py): started
  Building wheel for dash-unload-component (setup.py): finished with status 'done'
  Created wheel for dash-unload-component: filename=dash_unload_component-1.2.2-py3-none-any.whl size=9047 sha256=b7fcb9c8f49b8d277ae778414ecbf9c533cce804701577fd09adb3ea32989050
  Stored in directory: /Users/creuzige/Library/Caches/pip/wheels/96/8f/78/213d892555dae2d1941da64a897c10289d9e381277efac5055
Successfully built dash-unload-component
Installing collected packages: kaleido, dash-unload-component, tzdata, backports.zoneinfo, pytz-deprecation-shim, tzlocal, apscheduler, dash-bootstrap-components
  Attempting uninstall: dash-bootstrap-components
    Found existing installation: dash-bootstrap-components 1.1.0
    Uninstalling dash-bootstrap-components-1.1.0:
      Successfully uninstalled dash-bootstrap-components-1.1.0
Successfully installed apscheduler-3.9.1 backports.zoneinfo-0.2.1 dash-bootstrap-components-1.2.0 dash-unload-component-1.2.2 kaleido-0.2.1 pytz-deprecation-shim-0.1.0.post0 tzdata-2022.1 tzlocal-4.2

done
#
# To activate this environment, use
#
#     $ conda activate gsas-AustCalc
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(gsas-AustCalc) PN118888:AusteniteCalculator creuzige$ ls
Dockerfile      README.md       app         requirements.txt    server_workdir
ExampleData     SaveData        conda_gsas_env.yml  server_datadir      sphinx_docs
ExampleScripts      WorkFlowDiagrams    license.md      server_default_datadir  stan_files
(gsas-AustCalc) PN118888:AusteniteCalculator creuzige$ cd app/
(gsas-AustCalc) PN118888:app creuzige$ ls
__pycache__         austenitecalculator.pdf     export_file.txt         testing_data_setup.py
app.py              compute_results.py      fit.py              testing_mandel.py
assets              compute_uncertainties.py    pytest.ini
(gsas-AustCalc) PN118888:app creuzige$ python3 app.py 
Traceback (most recent call last):
  File "app.py", line 13, in <module>
    import dash_unload_component as duc
ModuleNotFoundError: No module named 'dash_unload_component'
(gsas-AustCalc) PN118888:app creuzige$ 
dnewton600 commented 2 years ago

Is dash_unload_component in the .yml file on your local filesystem? (And when the gsas environment is activated, and you run 'conda list', do you see 'dash_unload_component'?

I only ask because the above are true for mine and the app seems to run smoothly :|

creuzige commented 2 years ago

It is in the .yml file, but does not show up in the conda list.

dnewton600 commented 2 years ago

My guess is then that the conda environment was not built correctly from the .yml file. If the --update doesn't work, perhaps try recreating the conda environment?

conda env remove -n gsas-AustCalc

conda env create -f conda_gsas_env.yml

(You could also 'cheat' and just do >> pip install dash_unload_component )

creuzige commented 2 years ago

@dnewton600 Well, I think that issue was caused by my computer having multiple environments called the same thing. So that part is resolved. But now I get a different error:

(gsas-AustCalc) PN118888:app creuzige$ python app.py
Traceback (most recent call last):
  File "app.py", line 16, in <module>
    from dash_extensions.snippets import send_file
  File "/Users/creuzige/gsas2full/envs/gsas-AustCalc/lib/python3.7/site-packages/dash_extensions/snippets.py", line 7, in <module>
    from dash import html, Output, Input, callback_context
ImportError: cannot import name 'Output' from 'dash' (/Users/creuzige/gsas2full/envs/gsas-AustCalc/lib/python3.7/site-packages/dash/__init__.py)
dnewton600 commented 2 years ago

Maybe try pulling again from GitHub? In the app.py file 'Output' is imported from dash.dependencies, not dash, so maybe the local app.py file is out of date with the dash version?

Edit: Whoops, sorry, the error is in snippets.py so my comment isn't relevant :) This could be a fun thing to debug during our meeting!

creuzige commented 2 years ago

When I check GitHub and the file, they both say dash.dependencies; but I agree the error doesn't say that...

Yeah, probably something to debug later...

dnewton600 commented 2 years ago

If I do 'conda list' I see I have dash version 2.6.0 and dash-extensions 0.0.71. I wonder if the dash-extensions version in your environment is an earlier version (in which Output was imported from 'dash')?

creuzige commented 2 years ago

Looks like I have dash 2.0.0 and dash-extensions 0.0.71

dnewton600 commented 2 years ago

I assume it must be some update from the dash version. If you are in the environment and you start a python shell with

python

And then type

from dash import Output

I suspect it might throw an error, whereas somewhere along the way to 2.6.0 they added Output to the init.py file...

If this is the case we should probably specify the dash version in the .yml file

creuzige commented 2 years ago

Solved when updating to dash 2.6.0. I also needed to change my conda channel, this version was not listed in the default channel.