architecture-building-systems / CityEnergyAnalyst

The City Energy Analyst (CEA)
https://www.cityenergyanalyst.com/
MIT License
196 stars 62 forks source link

MacOS-arm64 GUI - Error: Could not create CEA environment. #3593

Closed brynpickering closed 4 months ago

brynpickering commented 4 months ago

Describe the bug I have tried installing CEA (+ GUI) from the pre-built DMG and following the manual install instructions.

In both instances, CEA installs just fine, but then encounters an error on startup: Could not create CEA environment.

To Reproduce Steps to reproduce the behavior:

  1. Install CEA on a macos-arm64 (i.e. Apple Silicon) device.
  2. Open the CEA-GUI app

Screenshots

Screenshot 2024-05-28 at 11 39 53

Hardware (please complete the following information):

reyery commented 4 months ago

Hi @brynpickering, thanks for reporting this issue to us. Unfortunately, we were not able to reproduce this error on our end. Could you let us know what is written in the logs found in ~/Library/Logs/CityEnergyAnalyst-GUI/main.log.

brynpickering commented 4 months ago

Opening app from manual install:

[2024-05-28 12:47:58.597] [info]  CEA GUI version: 3.36.0
[2024-05-28 12:47:58.600] [info]  Checking for GUI update...
[2024-05-28 12:47:58.606] [info]  Checking for update
[2024-05-28 12:48:00.436] [info]  Update for version 3.36.0 is not available (latest version: 3.36.0, downgrade is disallowed).
[2024-05-28 12:48:00.449] [debug] {
  versionInfo: {
    tag: 'v3.36.0',
    version: '3.36.0',
    files: [
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0-mac.zip',
        sha512: 'KK3eFxiNhoJl1co5VQxovw+nBdrp0xnJGda86UmnaSCBAv/nDcUNvZDlr/r+Gh/NLH1pKCsn/GJuBEO1ciQpyA==',
        size: 179491423
      },
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0-arm64-mac.zip',
        sha512: '84LdWGzpt09HcmxD95flFocmJ20qlEvTot8eXfJGXMgwzOqUAMKeA+NAKuddIfo8JHvgf5mgzQBIBW/YJVTQKw==',
        size: 172480688
      },
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0.dmg',
        sha512: 'bwURYdFl00IyUGlN6T8R+WylEn0PhhhGn3u+nOrmdf2iUc/BqD7gvsLXkSY2BYkdidx4p/Ajh3NaSH8qv+f9qg==',
        size: 186184010
      },
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0-arm64.dmg',
        sha512: 'C5sJRfh7ytKFmIEPDLOrSmCGMdR8nPRexVynBbo7Z/TDD4iQf39Syx4t3nV3dTRiA/+K8/Ts+zkV2au+w0XEUA==',
        size: 179168311
      }
    ],
    path: 'CityEnergyAnalyst-GUI-3.36.0-mac.zip',
    sha512: 'KK3eFxiNhoJl1co5VQxovw+nBdrp0xnJGda86UmnaSCBAv/nDcUNvZDlr/r+Gh/NLH1pKCsn/GJuBEO1ciQpyA==',
    releaseDate: '2024-05-21T16:09:42.660Z',
    releaseName: '3.36.0',
    releaseNotes: ''
  }
}
[2024-05-28 12:48:00.462] [debug] isCEAAlive(http://127.0.0.1:5050)
[2024-05-28 12:48:00.506] [error] No Response
[2024-05-28 12:48:00.507] [info]  Checking for CEA environment...
[2024-05-28 12:48:00.514] [debug] {
  micromambaPath: '/Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/micromamba'
}
[2024-05-28 12:48:00.519] [error] Error: Unable to find path to micromamba.
    at getMicromambaPath (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:37:11)
    at checkCEAenv (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:82:11)
    at preflightChecks (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:241:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async BrowserWindow.<anonymous> (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:289:7)
[2024-05-28 12:48:00.524] [info]  Creating CEA environment (3.36.0)...
(this might take a few minutes)
[2024-05-28 12:48:00.537] [debug] { ceaPath: '/Users/bryn.pickering/Documents/CityEnergyAnalyst' }
[2024-05-28 12:48:00.540] [debug] {
  message: 'Fetching conda-lock.yml',
  condaLockUrl: 'https://raw.githubusercontent.com/architecture-building-systems/CityEnergyAnalyst/v3.36.0/conda-lock.yml',
  condaLockPath: '/Users/bryn.pickering/Documents/CityEnergyAnalyst/conda-lock.yml'
}
[2024-05-28 12:48:00.945] [debug] {
  micromambaPath: '/Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/micromamba'
}
[2024-05-28 12:48:00.946] [error] Error: Unable to find path to micromamba.
    at getMicromambaPath (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:37:11)
    at file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:161:27
    at new Promise (<anonymous>)
    at createCEAenv (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:160:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async preflightChecks (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:255:11)
    at async BrowserWindow.<anonymous> (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:289:7)

Opening app from downloaded .dmg:

[2024-05-28 10:41:37.788] [info]  CEA GUI version: 3.36.0
[2024-05-28 10:41:37.797] [info]  Checking for GUI update...
[2024-05-28 10:41:37.800] [info]  Checking for update
[2024-05-28 10:41:39.577] [info]  Update for version 3.36.0 is not available (latest version: 3.36.0, downgrade is disallowed).
[2024-05-28 10:41:39.579] [debug] {
  versionInfo: {
    tag: 'v3.36.0',
    version: '3.36.0',
    files: [
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0-mac.zip',
        sha512: 'KK3eFxiNhoJl1co5VQxovw+nBdrp0xnJGda86UmnaSCBAv/nDcUNvZDlr/r+Gh/NLH1pKCsn/GJuBEO1ciQpyA==',
        size: 179491423
      },
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0-arm64-mac.zip',
        sha512: '84LdWGzpt09HcmxD95flFocmJ20qlEvTot8eXfJGXMgwzOqUAMKeA+NAKuddIfo8JHvgf5mgzQBIBW/YJVTQKw==',
        size: 172480688
      },
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0.dmg',
        sha512: 'bwURYdFl00IyUGlN6T8R+WylEn0PhhhGn3u+nOrmdf2iUc/BqD7gvsLXkSY2BYkdidx4p/Ajh3NaSH8qv+f9qg==',
        size: 186184010
      },
      {
        url: 'CityEnergyAnalyst-GUI-3.36.0-arm64.dmg',
        sha512: 'C5sJRfh7ytKFmIEPDLOrSmCGMdR8nPRexVynBbo7Z/TDD4iQf39Syx4t3nV3dTRiA/+K8/Ts+zkV2au+w0XEUA==',
        size: 179168311
      }
    ],
    path: 'CityEnergyAnalyst-GUI-3.36.0-mac.zip',
    sha512: 'KK3eFxiNhoJl1co5VQxovw+nBdrp0xnJGda86UmnaSCBAv/nDcUNvZDlr/r+Gh/NLH1pKCsn/GJuBEO1ciQpyA==',
    releaseDate: '2024-05-21T16:09:42.660Z',
    releaseName: '3.36.0',
    releaseNotes: ''
  }
}
[2024-05-28 10:41:39.592] [debug] isCEAAlive(http://127.0.0.1:5050)
[2024-05-28 10:41:39.637] [error] No Response
[2024-05-28 10:41:39.638] [info]  Checking for CEA environment...
[2024-05-28 10:41:39.643] [debug] {
  micromambaPath: '/Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/micromamba'
}
[2024-05-28 10:41:41.402] [debug] { ceaPath: '/Users/bryn.pickering/Documents/CityEnergyAnalyst' }
[2024-05-28 10:41:41.466] [error] Error: Command failed: "/Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/micromamba" -r "/Users/bryn.pickering/Documents/CityEnergyAnalyst" -n cea run cea --help
critical libmamba The given prefix does not exist: "/Users/bryn.pickering/Documents/CityEnergyAnalyst/envs/cea"

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
[2024-05-28 10:41:41.466] [info]  Creating CEA environment (3.36.0)...
(this might take a few minutes)
[2024-05-28 10:41:41.469] [debug] { ceaPath: '/Users/bryn.pickering/Documents/CityEnergyAnalyst' }
[2024-05-28 10:41:41.472] [debug] {
  message: 'Fetching conda-lock.yml',
  condaLockUrl: 'https://raw.githubusercontent.com/architecture-building-systems/CityEnergyAnalyst/v3.36.0/conda-lock.yml',
  condaLockPath: '/Users/bryn.pickering/Documents/CityEnergyAnalyst/conda-lock.yml'
}
[2024-05-28 10:41:41.558] [error] TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async downloadFile (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/download.mjs:16:30)
    at async fetchCondaLock (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:101:5)
    at async createCEAenv (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:156:3)
    at async preflightChecks (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:255:11)
    at async BrowserWindow.<anonymous> (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:289:7)
[2024-05-28 10:41:41.559] [error] TypeError: fetch failed
    at node:internal/deps/undici/undici:12345:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async downloadFile (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/download.mjs:16:30)
    at async fetchCondaLock (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:101:5)
    at async createCEAenv (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/cea/env.mjs:156:3)
    at async preflightChecks (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:255:11)
    at async BrowserWindow.<anonymous> (file:///Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/app.asar/electron/main.mjs:289:7)
[2024-05-28 10:41:41.566] [debug] {
  micromambaPath: '/Applications/CityEnergyAnalyst-GUI.app/Contents/Resources/micromamba'
}
[2024-05-28 10:41:41.569] [debug] { ceaPath: '/Users/bryn.pickering/Documents/CityEnergyAnalyst' }
[2024-05-28 10:41:41.644] [debug] Empty environment created at prefix: /Users/bryn.pickering/Documents/CityEnergyAnalyst/envs/cea
[2024-05-28 10:41:42.714] [error] critical libmamba YAML parsing error while reading environment lockfile located at '/Users/bryn.pickering/Documents/CityEnergyAnalyst/conda-lock.yml' : invalid node; first invalid key: "version"
brynpickering commented 4 months ago

Why is it looking for the micromamba executable within the app? I'd have thought it would look for the environment variable

brynpickering commented 4 months ago

From the downloaded .dmg, the issue could be that it's getting confused between my mamba and micromamba install. I use mambaforge day-to-day, but have micromamba available for testing (and installing CEA, it turns out!)

reyery commented 4 months ago

We actually package a micromamba binary in the .app to help users to create and manage the CEA environment automatically. But based on the logs, it seems that it failed to download the required conda-lock.yml file from this link to create the CEA environment. Could be some sort of network error, since the link seems to work on our end. We could add a few retries for fetching the file in the app before failing, to help with this problem. Could you click and test if you can reach the provided link manually? If it works, maybe try launching the .dmg version again and see if it works.

Actually if you have manually installed the CEA environment, you could also run CEA listening server in your environment i.e. running the command cea dashboard, before starting the GUI. It should detect the server and start immediately.

brynpickering commented 4 months ago

hmm, could be an SSL cert issue (although I don't think this should be an issue as I have the env variable NODE_EXTRA_CA_CERTS set up to point at my corporate cert).

cea dashboard followed by loading the GUI works fine.

reyery commented 4 months ago

I will close this issue for now. Let us know if you face any other issues.