Using anvil uplink with google colab argparse

Hi All, I am Seth and just learning how to make web applications as a hobby! I would like to install the anvil-uplink in google colab, but I am receiving the following error. WARNING: The following packages were previously imported in this runtime:
[argparse]
You must restart the runtime in order to use newly installed versions. I understand that later versions of python already maintain the argparse, so I am not sure how to solve this problem. Does anyone have advice?

1 Like

My advice is to search the forum for previous posts about colab and argparse, and then go from there. :slight_smile:

Welcome, by the way! :wave:

1 Like

I got the same issue.

Welcome to the Forum!

I agree with @hugetim’s advice. If that doesn’t give you what you need, then by all means, please continue in this thread.

1 Like

@anamolbaral29 do you have any ideas how to resolve this? I have seen some comments outside of this forum about trying to force python to use a specific version of argparse 1.4.0 and then when anvil-uplink tries to load this, it will see that it is already loaded. Any other ideas that you or others have are welcomed. If this is a systematic issue for all google colab, hopefully the team might be able to offer some guidance.

Please correct me if I’m wrong, but I thought the argparse module was already built into Python.

In this forum, too:

Hi, I am Hong An, I experienced the same issue. May I know at the end how do you solve this?

The short answer is that you can safely ignore that warning!

That message is just suggesting that you can do as it suggests (ie restart your Python kernel after the pip install anvil-uplink) if you have trouble with that package.

Hi Mr. Meredydd, thank you for your reply! However, when I tried to run the code of `anvil.server.wait_forever() in the Gogole COLAB, it keeps running without completion (after running 20min also without completing the code), could you please advise me?

This is precisely what the wait_forever does (wait forever). Imagine it as a while loop with no break condition. This actually prevents your notebook from shutting down.

However, if you have added a @anvil.server.callable decorator to a function, you can call that function from your main app.

Check out this tutorial Turning a Google Colab Notebook into a Web App (particularly the step 7)

3 Likes

Hi thank you for your reply! Now i understand clearly.

1 Like