Not able to import standard packages

What I’m trying to do:
I’m trying to use pandas in my client code to deal with importing a CSV file. When running my code, I get an error message saying that “no module pandas is found”

What I’ve tried and what’s not working:

  • I have gone into my settings and checked that the standard packages are installed and that pandas is a package.

Code Sample:

from ._anvil_designer import Streamschart_apiTemplate
from anvil import *
import anvil.server
import pandas as pd

class Streamschart_api(Streamschart_apiTemplate):
def init(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)

# Any code you write here will run before the form opens.

def button_1_click(self, **event_args):
“”“This method is called when the button is clicked”“”
file = anvil.media.wait_for_media()
if file.type != “application/vnd.ms-excel”:
raise ValueError(“Please upload a CSV file.”)
else:
streamer_data = clean_twitch_dataframe(file)
# Do something with the cleaned DataFrame, e.g. display it in a table
self.repeating_panel_1.items = streamer_data.to_dict(‘records’)

“ModuleNotFoundError: No module named ‘pandas’”

Clone link:
share a copy of your app

On the client side you only have access to packages available to Skulpt (The foundation Anvil is built on).

You have access to installed and standard packages only on the server side.

1 Like