NREL / lore

Other
1 stars 0 forks source link

Installing loredash #4

Closed odow closed 3 years ago

odow commented 3 years ago

@Matthew-Boyd a few things

  1. I think I need permission to access matthewtboyd/lore:

    (basic_3.8) oscar@Oscars-MBP lore-docker % docker pull matthewtboyd/lore:latest
    Error response from daemon: pull access denied for matthewtboyd/lore, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

    My docker hub account is odow: https://hub.docker.com/u/odow

  2. I have a linux VM on my MacBook, but I get errors trying to create the database:

    (loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ python manage.py migrate
    Traceback (most recent call last):
    File "manage.py", line 21, in <module>
    main()
    File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
    File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
    File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
    File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
    File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
    app_config.ready()
    File "/home/parallels/Documents/lore/loredash/mediator/apps.py", line 13, in ready
    mediator = mediator.Mediator()
    File "/home/parallels/Documents/lore/loredash/mediator/mediator.py", line 22, in __init__
    maps = self.pysam_wrap.ReadMaps()
(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ python ./data/import_data.py ./data
Using data file path: /home/parallels/Documents/lore/loredash/data
? Select which SQLite3 database to import to:  (Use arrow keys)                                                                                                                                            
Traceback (most recent call last):
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/cache.py", line 34, in get
    return self._data[key]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./data/import_data.py", line 51, in <module>
    answers = prompt(questions)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/PyInquirer/prompt.py", line 69, in prompt
    answer = run_application(
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/shortcuts.py", line 625, in run_application
    result = cli.run()
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/interface.py", line 413, in run
    self._redraw()
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/interface.py", line 358, in _redraw
    self.renderer.render(self, self.layout, is_done=self.is_done)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 424, in render
    layout.write_to_screen(cli, screen, mouse_handlers, WritePosition(
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 142, in write_to_screen
    sizes = self._divide_heigths(cli, write_position)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 177, in _divide_heigths
    dimensions = [get_dimension_for_child(c, index) for index, c in enumerate(self.children)]
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 177, in <listcomp>
    dimensions = [get_dimension_for_child(c, index) for index, c in enumerate(self.children)]
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 175, in get_dimension_for_child
    return c.preferred_height(cli, write_position.width, write_position.extended_height)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1652, in preferred_height
    return self.content.preferred_height(cli, width, max_available_height)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 999, in preferred_height
    preferred=self.content.preferred_height(
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 254, in preferred_height
    content = self.create_content(cli, width, None)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 259, in create_content
    tokens_with_mouse_handlers = self._get_tokens_cached(cli)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 238, in _get_tokens_cached
    return self._token_cache.get(
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/cache.py", line 37, in get
    value = getter_func()
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 239, in <lambda>
    cli.render_counter, lambda: self.get_tokens(cli))
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/PyInquirer/prompts/list.py", line 103, in _get_choice_tokens
    tokens.pop()  # Remove last newline.
IndexError: pop from empty list

Any ideas?

Matthew-Boyd commented 3 years ago

@odow I just added you to the docker hub repo as a collaborator so you should now have access. I also just merged some changes and simplified the database import of mock data to address your second exception. Everything is building and running for me now, including the docker image, and I've pushed the latest image build to docker hub. Keep me posted with any more issues you find.

odow commented 3 years ago

I have the docker-hub build working. But did you push your changes? The last commit I see in lore was 8 days ago.

Matthew-Boyd commented 3 years ago

Nope... Just pushed. Thanks.

On Wed, Nov 18, 2020 at 4:25 PM Oscar Dowson notifications@github.com wrote:

I have the docker-hub build working. But did you push your changes? The last commit I see in lore was 8 days ago.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NREL/lore/issues/4#issuecomment-730009638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHICFBZAMELIG47RRXREET3SQRJUTANCNFSM4TX74MHQ .

odow commented 3 years ago

Do I need the sqlite file?

(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ git status
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 361, in execute
    self.check()
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 387, in check
    all_issues = self._run_checks(
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 65, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/urls/resolvers.py", line 398, in check
    for pattern in self.url_patterns:
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/urls/resolvers.py", line 579, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/urls/resolvers.py", line 572, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/parallels/Documents/lore/loredash/loredash/urls.py", line 30, in <module>
    mediator = mediator.Mediator(override_with_weather_file_location=True,
  File "/home/parallels/Documents/lore/loredash/mediation/mediator.py", line 33, in __init__
    self.pysam_wrap = pysam_wrap.PysamWrap(plant_config=self.plant_config, model_name=self.default_pysam_model,
  File "/home/parallels/Documents/lore/loredash/mediation/pysam_wrap.py", line 33, in __init__
    self.PreProcess()                                   # do this now so no simulation delay later
  File "/home/parallels/Documents/lore/loredash/mediation/pysam_wrap.py", line 37, in PreProcess
    solar_resource_data = PysamWrap.GetSolarResourceDataTemplate(plant_location=self.plant_config.location)
AttributeError: 'dict' object has no attribute 'location'

(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ python ./data/import_data.py ./data/
Using data file path: /home/parallels/Documents/lore/loredash/data
Writing to ui_forecastsmarketdata...
Traceback (most recent call last):
  File "./data/import_data.py", line 80, in <module>
    cur.executemany('insert into ' + table + ' (id, timestamp, market_forecast, ci_plus, ci_minus) values (?,?,?,?,?);', data_to_db)
sqlite3.OperationalError: no such table: ui_forecastsmarketdata
Matthew-Boyd commented 3 years ago

I don't think the sqlite file is the main problem, but yes, you do need this. This database file is first created by running: python manage.py migrate

Then the user-defined 'models' are translated into tables, and then those are migrated, by running: python manage.py makemigrations python manage.py migrate

Whenever there is a new table added, as shown by the last error in your capture, you need to run these two commands. And then related, if you haven't run the following to populate the database with the mock data, then now would be a good time to do that too: python ./data/import_data.py ./data

Lastly, there's another error here from line 37 in the pysam_wrap.py . I'm not sure why it is throwing for you and not me, but it should be an easy workaround if you investigate a little. This part isn't fully implemented but you should be able to use a default or generic plant location, and I believe a flag is set to use the weather file location anyway. Keep me posted, I can look into this tomorrow.

On Wed, Dec 2, 2020 at 4:04 PM Oscar Dowson notifications@github.com wrote:

Do I need the sqlite file?

(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ git statusOn branch developYour branch is up to date with 'origin/develop'. nothing to commit, working tree clean

(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ python manage.py migrateTraceback (most recent call last): File "manage.py", line 21, in main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, cmd_options) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 361, in execute self.check() File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 387, in check all_issues = self._run_checks( File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 65, in _run_checks issues.extend(super()._run_checks(kwargs)) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/urls/resolvers.py", line 398, in check for pattern in self.url_patterns: File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/urls/resolvers.py", line 579, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/utils/functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/site-packages/django/urls/resolvers.py", line 572, in urlconf_module return import_module(self.urlconf_name) File "/home/parallels/anaconda3/envs/loredash/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "/home/parallels/Documents/lore/loredash/loredash/urls.py", line 30, in mediator = mediator.Mediator(override_with_weather_file_location=True, File "/home/parallels/Documents/lore/loredash/mediation/mediator.py", line 33, in init self.pysam_wrap = pysam_wrap.PysamWrap(plant_config=self.plant_config, model_name=self.default_pysam_model, File "/home/parallels/Documents/lore/loredash/mediation/pysam_wrap.py", line 33, in init self.PreProcess() # do this now so no simulation delay later File "/home/parallels/Documents/lore/loredash/mediation/pysam_wrap.py", line 37, in PreProcess solar_resource_data = PysamWrap.GetSolarResourceDataTemplate(plant_location=self.plant_config.location)AttributeError: 'dict' object has no attribute 'location'

(loredash) parallels@parallels-Parallels-Virtual-Platform:~/Documents/lore/loredash$ python ./data/import_data.py ./data/Using data file path: /home/parallels/Documents/lore/loredash/dataWriting to ui_forecastsmarketdata...Traceback (most recent call last): File "./data/import_data.py", line 80, in cur.executemany('insert into ' + table + ' (id, timestamp, market_forecast, ci_plus, ci_minus) values (?,?,?,?,?);', data_to_db)sqlite3.OperationalError: no such table: ui_forecastsmarketdata

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NREL/lore/issues/4#issuecomment-737549063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHICFB27ZVTNTRVFIJWWVUTSS3BZTANCNFSM4TX74MHQ .