Anvil Community Forum

📢 New Beta: Install Any Python Package Instantly

Hi everyone,

We’re pleased to announce that it’s now even easier to take advantage of Python’s rich packaging ecosystem in Anvil! Today, we’re launching self-service package installation to public beta, bringing the full flexibility of pip install to your apps and allowing you to install packages yourself.

To access this beta, all you need to do is go to an app’s Settings in the Beta Editor, and select ‘Python 3.10 (Beta)’ from the drop-down in ‘Python versions’.

Once you’ve selected Python 3.10 as the Python version for your app, you’ll be offered the choice of 3 Base Environments: Minimal, Standard and Data Science. These environments come with different sets of packages pre-installed; for example, Standard includes numpy and pandas, and Data Science includes matplotlib and more. For more information on what’s in each of the Environments, check out the documentation.

Once you’ve chosen a Base Environment, you can add additional packages to your app by entering a given package’s name (and optionally a version number) as it appears in PyPI:

Then, after you’ve added all your desired packages, Anvil will build your app’s new environment; you can see the output of this build process in the collapsible section below Packages.

Anvil will also use safety to check whether the package versions you’ve chosen have any known vulnerabilities.

Once you’ve set up your app’s environment, you’re good to go! Simply import your packages in your server code wherever you need.

For more information, including the contents of the Base Environments and guidance for installing packages from sources other than PyPI, check out the documentation:

http://anvil.works/docs/server/custom-packages

This feature is in beta right now - there will probably be some issues, and behaviour may change over the next couple of weeks. As always, please let us know if you have any problems!

29 Likes

Wow, that is amazing! That should rule out the digital ocean droplet I am keeping alive right now… looking forward to test it. Thanks for the great work.

2 Likes

The Anvil team continues their tradition of humbly dropping game-changing features without much fuss or fanfare. You’ve done it again, a big congrats to the team!

6 Likes

Fantastic, this is really a huge feature to have! Next would be great if users can install their private packages by uploading files (like .whl). Keep up the good work!

Just yesterday I was like “I can’t prototype this in Anvil because I need specific versions for [INSERT PACKAGES HERE]”. Then I saw this email come through. :smiling_face_with_three_hearts:

3 Likes

A post was split to a new topic: Python 3.10 Beta Missing

2 posts were split to a new topic: ModuleNotFoundError for numpy