Closed rbavery closed 2 years ago
It looks like the gcc dependencies can't be installed via pypi, only conda...
This indicates that if we distribute AOT compiled modules we will need to switch to a conda based setup and document that, instead of using pip in order to handle the compiler dependency. Or am I missing something?
Have you tried running the solution.py file locally first, then run pip install -e . again
Basically just overwriting the solution_aot file included in the package
I have also had issues when testing the new pypi upload, where it cant locate the solution_aot.so file even though it is inlcuded in the pip package
I did not try that, but thanks for mentioning it. What I did instead was set up a conda environment that installed the gcc dependencies. Then I locally installed aquacrop with pip and I think I already had the compiled file so it worked. So I'm not sure but it seems like maybe gcc is a requirement to run the compiled functions?
Shouldn't the code be compiled on target (user's system) during the pip install? Otherwise we would need to ship compiled code for each architecture and python version..
Have finally got the pypi package upload/download working. Was running into all kinds of errors while using the methods described here https://numba.pydata.org/numba-doc/dev/user/pycc.html.
One of which is similar to the point made by @arongergely that the compiled binarys only work for my local pc. pip was having a hard time building these into a wheels and so we now have to build a source distribution instead of wheels. The other reason to dot build a wheels is that we want to run a compilation script as the user pip installs the module so that the binary works for their architecture as @arongergely said.
Will create a pull request tomorrow that does this as well as creating a github action to push to pypi following a new version release.
Can go into more detail in that pull request if you have any more questions about the wheels erros etc.
And to your point @rbavery about gcc dependecy: I can pip install (and then compile) inside a fresh google colab using the code below without issue so I dont think we are assuming any crazy dependencies.
!pip install numba==0.55
!pip install -i https://test.pypi.org/simple/ aquacrop==0.4.18
from aquacrop.classes import *
from aquacrop.core import *
path = get_filepath('champion_climate.txt')
wdf = prepare_weather(path)
def run_model(smts,max_irr_season,year1,year2):
maize = CropClass('Maize',PlantingDate='05/01')
loam = SoilClass('ClayLoam')
init_wc = InitWCClass(wc_type='Pct',value=[70])
irrmngt = IrrMngtClass(IrrMethod=1,SMT=smts,)
# create and run model
model = AquaCropModel(f'{year1}/05/01',f'{year2}/10/31',wdf,loam,maize,
IrrMngt=irrmngt,InitWC=init_wc)
model.initialize()
model.step(till_termination=True)
return model.Outputs.Final
run_model([70]*4,300,2018,2018)
When I run the aquacrop-streamlit app, I get this error
I'm setting up dependencies in a venv and not using conda. This may mean we need to add the gcc compiler dependency for a specific architecture family to the aquacrop dependencies: https://numba.pydata.org/numba-doc/dev/user/pycc.html