natcap / invest

InVEST®: models that map and value the goods and services from nature that sustain and fulfill human life.
Apache License 2.0
166 stars 68 forks source link

Workbench crashes when anaconda is on the PATH #1643

Open phargogh opened 1 week ago

phargogh commented 1 week ago

A student in the InVEST class was unable to launch the InVEST workbench on Windows, and the workbench logfile looked like this:

[17:57:52.975] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] Windows detected, requesting single instance lock
[17:57:53.030] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] Running invest-workbench version 3.14.2
[17:57:56.008] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] Found invest binaries "C:\Program Files\InVEST 3.14.2 Workbench\resources\invest\invest.exe" for version 
[17:57:56.017] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] Started python process as PID 13576
[17:57:56.338] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] retry # 1
[17:57:56.398] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] Traceback (most recent call last):
  File "osgeo\__init__.py", line 30, in swig_import_helper

[17:57:56.399] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js]   File "importlib\__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 921, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 813, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1289, in create_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
ImportError: DLL load failed while importing _gdal: The specified procedure could not be found.

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "invest\cli.py", line 16, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "natcap\invest\datastack.py", line 35, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "osgeo\__init__.py", line 35, in <module>
  File "osgeo\__init__.py", line 32, in swig_import_helper
  File "importlib\__init__.py", line 90, in import_module
ModuleNotFoundError: No module named '_gdal'
[1380] Failed to execute script 'cl
[17:57:56.399] [C:\Program Files\InVEST 3.14.2 Workbench\resources\app.asar\build\main\main.js] i' due to unhandled exception!

The specific PATH entries that were preventing InVEST from launching were:

When the student removed all three of these entries (I do not know if they tested each one individually), the workbench was able to launch.

A few other observations about the student's system:

The student had a username that was entirely ASCII character

phargogh commented 1 week ago

1610 is related since it'd be helpful to inspect the cause of the error without having to dig into the logs directory.

davemfish commented 21 hours ago

I tried reproducing this on a Windows VM and was not able to. I first installed Anaconda, which placed about 5 different paths on my user's PATH, then I installed and ran the Workbench. I did not get any import errors.