Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

name 'load_default_simulations' is not defined #14

Open
elaaatif opened this issue Sep 18, 2024 · 3 comments
Open

name 'load_default_simulations' is not defined #14

elaaatif opened this issue Sep 18, 2024 · 3 comments

Comments

@elaaatif
Copy link

[Running] python -u "k:\for apsim prog\APSIMNGPY\test1.py"
Traceback (most recent call last):
File "k:\for apsim prog\APSIMNGPY\test1.py", line 18, in
soybean_model = load_default_simulations(crop = 'soybean') # don't worry it is not case senstive
^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'load_default_simulations' is not defined


'we installed the requirements except building the APSIM from its source code , we have considered using the https://www.apsim.info/documentation/model-documentation/developer-documentation/building-apsim-from-source/
but we tried to run the usage code first but it is not working so far , we don't know if it is related to the paths or is it necessary to build the APSIM ?
thank you .

@MAGALA-RICHARD
Copy link
Owner

Hello, which operating system are you using? Did you install .Net core?

@elaaatif
Copy link
Author

elaaatif commented Sep 18, 2024

hello, I'm using windows 10 version 22H2 , and yes we installed the .Net SDK as mentioned in the readme file , and we are using two different machines and we have the same error on both .
I'd like to mention that we couldn't find the bin file for the APSIM
image
as shown in the picture above , the only bin file found is the one in the TClLink folder

@MAGALA-RICHARD
Copy link
Owner

Please remember the following information:

You can add the APSIM binary folder to the system path or use the config module to change the APSIM binary folder path. You don't need to build from source. All you need to do is install APSIM and then add the path to the Python environment.

if you open the edit system environment variables and you can see APSIM or Models in there Please do the following:

# search for the program binary installation path and add to os.environ as follows
import os
# A more intuitive way is to use apsimNGpy config Module
from apsimNGpy.config import Config
# now set the path to ASPIMX binaries
Config.set_aPSim_bin_path(path = r'path/toyourapsimbinaryfolder/bin)
# in the pythonnet_config module, priority is first given to the user supplied binary path, we also search through the python global env using the os module,
# if that fail it searches through other sources such as the user program installation folders.
# Not sure whether this can work all the time but you can try changing through os.environ as follows:
os.environ['APSIM'] =r'path/toyourapsimbinaryfolder/bin
# or
os.environ['Models'] =r'path/toyourapsimbinaryfolder/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants