Menu Close

Errors running the Omniscape example

Syncrosim Forums SyncroSim – General Questions and Answers Errors running the Omniscape example

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21513
    davidandersondavidanderson
    Participant

    Hi,
    I was working through the new Omniscape demo. I am getting the following errors in the Run Log when trying to run the 25 radius example:

    STARTING SIMULATION: 1/6/2023 : 11:37:58 AM

    Parent Scenario is: [3] Radius: 25
    Result scenario is: [5] Radius: 25 ([3] @ 06-Jan-2023 11:37 AM)

    CONFIGURING: omniscapeTransformer

    RUNNING: omniscapeTransformer
    Conda installation: C:\Users\davidanderson\SyncroSim\Conda
    Conda environment: C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment
    [Failure] The external program failed.
    Program name was: C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment\python.exe
    Arguments were: “C:\Users\davidanderson\SyncroSim\Packages\omniscape\omniscapeTransformer.py”
    Exit code was: 1
    More information:
    Traceback (most recent call last):
    File “C:\Users\davidanderson\SyncroSim\Packages\omniscape\omniscapeTransformer.py”, line 3, in <module>
    import pysyncrosim as ps
    File “C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment\lib\site-packages\pysyncrosim\__init__.py”, line 5, in <module>
    from pysyncrosim.raster import Raster
    File “C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment\lib\site-packages\pysyncrosim\raster.py”, line 2, in <module>
    import rasterio
    File “C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment\lib\site-packages\rasterio\__init__.py”, line 24, in <module>
    os.add_dll_directory(p)
    File “C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment\lib\os.py”, line 1109, in add_dll_directory
    cookie = nt._add_dll_directory(path)
    OSError: [WinError 87] The parameter is incorrect: ‘.’

    SIMULATION COMPLETE: 1/6/2023 : 11:38:00 AM
    Total simulation time: 00:00:01

    #21517
    carina-firkowskicarina-firkowski
    Keymaster

    Hi,

    Sorry for the wait, we were working on isolating and reproducing the issue.

    The issue is generated when importing one of the pysyncrosim dependencies, rasterio. We are submitting an issue on the rasterio GitHub repository to get the bug resolved.

    In the meantime, you can run omniscape without using conda and installing the required dependencies on your own. To do so, open the Library Properties by right-clicking on the Library name (Omniscape Example) and select Properties from the context menu. Navigate to the Advanced tab and at the General datasheet deselect the option “Use Conda”. Next, you will need to install python, pysyncrosim, pandas, rasterio and gdal, if they are not installed on your computer. Then, before running omniscape, you will need to specify the path to the python executable file. To do so, go to the Library Properties again. Under the Python Configuration tab, select Run directly and use the browse button to navigate to where your python.exe file is.

    Alternatively, if you’d like to use the conda environment, you will need to modify the Windows PATH variable. Certain programs, when installed or configured, add a “.” to the Windows PATH. When running the omniscape package, the import of the rasterio package loops through the directories in the PATH and tries to add this “.” to its search path using the os.add_dll_directory() function. This leads to the error because “.” is an invalid parameter for the os.add_dll_directory() function. You can read more about this error and check the progress of its resolution at https://github.com/rasterio/rasterio/issues/2705.

    If you still want to run omniscape using conda you will need to remove certain programs from your Windows PATH variable. To check which programs are adding “.” to the PATH, you can run os.environ[“PATH”] in python and do a search for all “;.”. Any folders that come before this “;.” are adding the “.” to the PATH.

    Cheers,
    Carina

    #21540
    davidandersondavidanderson
    Participant

    Thanks for the reply. This is a bit of a weird error.

    I looked at the PATH variable on my computer. No ‘.’ (dots) in it.

    I opened the Python interpreter in the omniscape Conda environment (C:\Users\davidanderson\SyncroSim\Conda\envs\omniscape\omniscapeEnvironment). Importing rasterio and pysyncrosim worked with no problem.

    I was able to get the example to run using option 1. I pointed the Python to the one in the omniscape environment. One addition I did have to make was setting up the Julia configuration to point to that executable.

    This indicates to me that the ‘.’ is getting added to the path before the call to pysyncrosim.

    #21541
    katie-birchardkatie-birchard
    Keymaster

    Hi David,

    Thanks for your perseverance with this issue. It is definitely a strange one!

    First, how did you look at your PATH variable? When viewing the PATH variable from the Windows Control Panel or printing out the results of running “path” in the command prompt, the “.” (dots) are not visible. They are only visible when calling os.environ[“PATH”] from a Python interpreter.

    Second, you were able to import rasterio and pysyncrosim no problem from the Python interpreter because the issue only arises when running omniscape from the SyncroSim User Interface. This is because rasterio is looking for a GDAL DLL in all paths specified from running os.environ[“PATH”] in Python, and when running from the SyncroSim UI, the current directory (i.e., “.”) also contains a GDAL DLL. On import, rasterio enters all paths that contain a GDAL DLL into the os.add_dll_directory() function, including the “.”, which is invalid and results in the error you see here. When running from the Python interpreter, the current directory (i.e., “.”) does not contain a GDAL DLL, so all works as expected.

    Cheers,
    Katie

    #21545
    carina-firkowskicarina-firkowski
    Keymaster

    Hi Dave,

    We just created a package release for omniscape to fix the issue you were having.

    You can update to the new package version in SyncroSim by selecting File, Packages. Then, click on the Update… button, select omniscape; and click OK. Create a new library from the template library and when prompted to overwrite the conda environment, select Yes.

    Now, you should be able to run the package with the Use Conda option selected.

    Best,
    Carina

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.