NIVANorge / Aquamonitor-Python

Python scripts to access Nivabasen through python.
1 stars 0 forks source link

get_projects is failing with "['project_code'] not in index" #16

Open lisapro opened 2 months ago

lisapro commented 2 months ago

Importmal app is using Aquamonitor-Python for getting the data https://github.com/NIVANorge/importmal_app/tree/master I use it though Jupyter Hub

Now it fails on get_projects function, I see that there were recent changes in it. Could you please take a look?

roarbra commented 1 month ago

We have to update the images used by Jupyterhub, so that they references aquamonitor-python 0.3.3. https://github.com/NIVANorge/niva_jupyter_hub/issues/30

lisapro commented 1 month ago

I have temporarily downloaded older version on jupyter hub with !pip install --user --force-reinstall git+https://github.com/NIVANorge/Aquamonitor-Python.git@6cf4abf since the updated versions cause incompatibility. There are still some messages, but the functions seem to work, I will check more

lisapro commented 1 month ago

no, I was wrong, it did not work, because the next commit (that has the error in the func) has the same version, I guess this is the resason why git still installs it. I can make a branch, downgrade libraries and install from the branch, is it ok for you?

roarbra commented 1 month ago

I don't see why you should downgrade. The 0.3.3 version works.

lisapro commented 1 month ago

becuase current versions of libraries joblib>=1.4 pandas>=2.2 requests>=2.32 yaspin>=3.0 cause incompatibilites in the Hub. And I need this to be up an runnning correctly by Friday morning. So the temporary solution is to downgrade those libraries to avoid incompatibilities.

JamesSample commented 1 month ago

Is it necessary for AM-Python to have such strict dependencies, @roarbra ? E.g. here I see we now require requests>=2.32 and yaspin>=3.0. Does the library actually rely on new features introduced in those versions, or would it actually work OK with older versions (requests>=2.24 and yaspin>=2.5.0)?

Having strict dependency pinning is fine if necessary, but otherwise it makes dependency resolution on the Hub harder, as outlined here.

@lisapro On your Hub, try

pip install --user --no-deps git+https://github.com/NIVANorge/Aquamonitor-Python.git

I've just tested on my Hub and it successfully installs aquamonitor-0.3.3 and the example notebook still runs OK afterwards. Hopefully it'll work for you too as a temporary fix?

lisapro commented 1 month ago

@JamesSample the --no-deps option fixed it, yes!

roarbra commented 1 month ago

No, not at all. I'm just pushing these versions to be up to date, and avoid warnings about vulnerabilities. I will stop doing that.

JamesSample commented 1 month ago

I guess vulnerabilities are a good reason to keep updating the pinning. Maybe we can try to find a balance somewhere in the middle?

You can also keep doing exactly as you are, because

pip install --user --no-deps git+https://github.com/NIVANorge/Aquamonitor-Python.git

should work, unless one day AM-Python really does rely on new features only available in the updated requirements.txt. If this happens, the command above won't fix AM-Python, but it won't break the environment either. Then I just have to spend some time investigating dependencies (which I do anyway during the periodic updates).