aquacropos / aquacrop

AquaCrop-OSPy: Python implementation of AquaCrop-OS
https://aquacropos.github.io/aquacrop/
Apache License 2.0
102 stars 73 forks source link

Deprecation package updates #135

Open florentdemelezi opened 7 months ago

florentdemelezi commented 7 months ago

Discussed in https://github.com/aquacropos/aquacrop/discussions/134

Originally posted by **florentdemelezi** April 2, 2024 Hi all, I am trying to use aquacrop in vscode although using python 3.8.10 and 3.10 I seem to get the same error message for from numba.pycc import CC which prohibits running the modules and package itself in visual-studio-code. Is it planned to update the aquacrop module or if someone solved it they could guide me through it? I noticed that the **from numba.pycc import CC** is deprecated and need to be modified? # temporary name for compiled module cc = CC("solution_cc_development") @cc.export("cc_development", "f8(f8,f8,f8,f8,f8,unicode_type,f8)") def cc_development( CCo: float,
tfoster88 commented 4 months ago

Thanks @florentdemelezi. If you are getting issues with compiling, usually it can be solved by the following troubleshooting steps:

First, run "python -m aquacrop.scripts.initiate_library" in your terminal, if this generates an error such as "RuntimeError: Attempted to compile AOT function without the compiler used by numpy.distutils present. Cannot find suitable msvc.", then you need to download and install an MSVC compiler such as the one included in Visual Studio build tools (see e.g. https://www.youtube.com/watch?v=p_R3tXSq0KI).

If this doesn't help solve the error message, then you can run aquacrop in pure python using:

import os

os.environ['DEVELOPMENT'] = 'DEVELOPMENT'

This second fix will make the model slower as it turns off the ahead of time compiling which is the common cause of these kinds of error messages

We are looking into alternatives to the numba AOT as its generally been a bit of a pain to maintain, but fixing this will take a few weeks at least