Voila does not work for me

I think its because you haven’t uploaded the .pkl file in your repo and its trying to find it .

Thanks for helping me, but the export.pkl is in the repo.

Can you try changing the fastai version in requirements.txt to fastai>=0.0.16

This is the error that occurs in your path/‘export.pkl’ line
AttributeError: ‘str’ object has no attribute 'stored_args

@Uh_shwin I really appreciate you taking the time to reply to my comments. Well I did the changes as you sugested and I updated the screeshots in my previous comments. Maybe you could check it to see if you find some mistake.

its okay this will help someone in the future

unfortunately , I cant figure out what’s wrong , if you figure out a way lemme know too .

for the poxis path error

when you train your model on colab / gradient and download it
then do inference on windows

Just redirect PosixPath to WindowsPath.

import pathlib
temp = pathlib.PosixPath
pathlib.PosixPath = pathlib.WindowsPath

1 Like

yes i am having the same problem, did you fix it?

Nopes. I guess, you cannot run voila on Colab. If you wanna run Voila, go for PaperSpace Gradient instead. Colab won’t allow you to run a web application I guess. Please correct me someone if I’m wrong, or if someone else has done it.

I believe this path thing (converting from / to , linux vs windows) is the real issue here. I already have the lines that you are suggesting, but the same problem remains. Was anyone able to fix this issue?

have you manage to solve the issue? I am facing same problem when using Colab + Binder

In my case the error was caused by missing import required by VBox:

from ipywidgets import *

Additionally I have switched from requirements.txt to Docker file

If you directly use webbrowser.open() - it will always open the link in the default browser. What you can do is to register the any other browser and then launch a new tab. Something like this:

webbrowser.register(name, constructor, instance=None)

Once a python browser type is registered, the get() function can return a controller for that browser type. You can run open, open_new and open_new_tab on the controller object. This will ensure the commands are executed on the same browser instance you opened.

import webbrowser    
url='https://www.google.com'
chrome_path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(chrome_path),1)
webbrowser.get('chrome').open_new_tab(url)

If you want to get recognized browsers on your system:

import webbrowser
print webbrowser._browsers

@wcneill @ricardocalleja
I can see I am almost a year/half year behind you but hope that if it doesn’t help you, it might someone else searching on a similar problem.

TL;DR
There is a missing creation of the btn_run object but a later call to it, which fails the script samples you’ve both provided.
Separately, I also found that there is a python/pip change post Oct 2020 that affects if copy pasting from the example nb from fastai.

Detail
I’ve debugged this particular bit of code, which seems to be confusing in the fastai lesson because of the mixing of a components to do step by step checking (with #hide descriptors at the top of the cell) and the code you need to pull out to create a local voila.
What I can see is that the object for ‘btn_run’ hasn’t been created prior to the function in either of your code samples and its called later on, causing a execution stop.

I.e. there is no classify button object for btn_run.on_click(on_click_classify) to act upon and therefore there is a execution error and the error message.
I also don’t see a modifier for the btn_upload to carry this out either, like Jeremy must of done in the demonstration in Lesson 3 video (i think lesson 3?!).

Adding:
btn_run = widgets.Button(description=‘Classify’)

results in a working program.

For those also copy pasting, there is a python change that will have voila fail when rendering the .ipynb. I would avoid or comment out
!pip install -Uqq fastbook

or add the modifier to test, as the way pip deals with dependencies has changed recently >Oct 2020 and this will result in a failure of the nbconvert script that voila relies on for conversion.

I found by "repip’ing’:
pip install voila
resolved to the correct version of nbconvert and allowed a successful render of the program to a local server.

I’ve tested at binder and this works also.
There are a few odd behavioral bugs but they aren’t functional, so I chose to ignore them with toy code.

I’ve found using jupyterlabs is tricky and needs a couple of extensions to be added, so things such as GCP are difficult, and it was easier to resolve on local machine with a copy of jupyter notebooks in a virtualenv.

HTH
Steve

2 Likes

I found fastbook package isn’t included in requirements.txt of many previous example. You can check my repo if you encounter same problem:

1 Like

Thanks a lot @steve_dl_1

this solved it for me thanks. I just copied those three lines into a notebook cell and boom!
thanks D_SM

How to Deploy Fast.ai Models? (Voilà , Binder and Heroku)

Medium article:
https://medium.com/unpackai/how-to-deploy-fast-ai-models-8704ea711ad2

code:

I hope this may help.

Thank you Nguyen, this worked for me, wondering what is the relation to fastbook , wont fastai package be sufficient for this ?

Hi, new user to fast.ai - tried deploying to both binder and heroku, but it always came up with this screen:

My github repo is here: Any help would be much appreciated!

deploy logs seem alright for both heroku and binder, can’t figure out why this is taking so long (it’s always stuck at 16/33) - https://bear-classifier-dan.herokuapp.com/

Did you face this same issue? could it be the .pkl file being too large?

Not sure if this will help anyone, but I ran into problems getting Voila to work and noticed that this forum was dated (2021 and earlier). I got things working, so I’m posting my Git repository as a recent example.