Open BjoerndalM opened 3 weeks ago
Dear @BjoerndalM , can you tell us the steps before you run the code? What install steps are you using and what's the python package version. Maybe also include the windows OS version. Thanks.
I am using the Spyder IDE, and running Python 3.9.7. Like i said, the MIKE+ installation is the 2024 version, but i have both the 2021 and 2023 version installed as well. (Could this be the issue?). My windows os is Windows 10.0.
The mikeplys libary was installed using the link: https://github.com/DHI/mikepluspy/archive/refs/tags/v2024.0-latest.zip
I have tried uninstalling both the 2021 version and 2023 version of MIKE+, meaning i now only have the MIKE Urban 2020 version and MIKE+ 2024 version installed. The result, when trying to open the db, is the same, sadly.
When trying to use other functions from the mikepluspy libary i get errors as well, such as this one when i am trying to run the 1d Engine: RuntimeError: Failed to initialize Python.Runtime.dll
Failed to initialize pythonnet: System.InvalidOperationException: This property must be set before runtime is initialized ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size) ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)Failed to initialize pythonnet: System.InvalidOperationException: This property must be set before runtime is initialized ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size) ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)Failed to initialize pythonnet: System.InvalidOperationException: This property must be set before runtime is initialized ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size) ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)Failed to initialize pythonnet: System.InvalidOperationException: This property must be set before runtime is initialized ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size) ved Python.Runtime.Runtime.set_PythonDLL(String value) ved Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)
@BjoerndalM I think the latest runtime error is not related to mikepluspy package. Please check this link as a reference. https://stackoverflow.com/questions/76214672/failed-to-initialize-python-runtime-dll#:~:text=To%20resolve%20this%2C%20go%20to%20the%20virtual%20environment,the%20python%20code%20again%20to%20see%20its%20working%21 About the first database problem, we will try hard to reproduce it. We have no success to reproduce for the time being.
Thank you wuwwen, i will check out the stackoverflow link.
Regarding the first problem, the database problem, i have noticed that i cant find the dll files for the DHI.Amelia.DataModule.Services, i only have the following:
The files are located at: C:\Program Files (x86)\DHI\MIKE+\2024\bin\x64
@wuwwen I tried following the stackoverflow link that you send me.
I still get the runtime error, but not before i run the script second time.
The first time i run the scrip i get the following error message:
@BjoerndalM i think you are using the wrong version. If you installed MIKE+ 2024, please use this command to install mikepluspy: pip install https://github.com/DHI/mikepluspy/archive/refs/tags/v2024.0-latest.zip
If you installed MIKE+ 2024 update 1, please use below way to install mikepluspy: pip install https://github.com/DHI/mikepluspy/archive/refs/tags/v2024.1-latest.zip
Based on the error message, i think you have MIKE+ 2024 software installed, but used mikepluspy of 2024 update 1 version.
@wuwwen You were right about the mix up of versions, but using the correct version (MIKE+ 2024), means that i am back to the problem that i originally posted, regarding the missing DHI.Amelia.Services
@wuwwen I asked a colleague to tried to run the code, and he got the excact same error, about the missing files.
Like i said earlier, i dont have any files named DHI.Amelia.DataModule.Services.dll, neither does my colleague. I dont know if i am supposed to have that ?
When trying to open a database i get the error: SQLiteException: code = Error (1), message = System.Data.SQLite.SQLiteException (0x800007BF): SQL logic error Det angivne modul blev ikke fundet. ved DHI.Amelia.DataModule.Services.DataSource.DataSourceSpatiaLite.OpenDatabaseCore() ved DHI.Amelia.DataModule.Services.DataSource.BaseDataSource.OpenDatabase()
the code look like this: from mikeplus import DataTableAccess from pathlib import Path
sti_db = Path('C:\Users......\Test.sqlite') db = DataTableAccess(sti_db)
db_open = db.open_database()
The database has been made in a 2024 version of the mike+ program.