Voila does not work for me

I finally got to the point where I was ready to deploy my model, and as always, nothing works as advertised:

I created my inference notebook with this simple code, which runs just fine in Jupyter Notebooks:

from utils import *
from fastai2.vision.widgets import *
from fastai2.vision.all import *

inferencer = load_learner('export.pkl')
btn_upload = widgets.FileUpload()
out_pl = widgets.Output()
lbl_pred = widgets.Label()
# listener method:
def on_click_classify(change):
    img = PILImage.create(btn_upload.data[-1])
    with out_pl:
    pred, idx, probs = inferencer.predict(img)
    lbl_pred.value = f'Predicted {pred} with {probs[idx]*100:.01f}% certainty'

     widgets.Label('Squash IT!'),

Then I click “voila” to run it and I get a very cryptic error message:

There was an error when executing cell [6]. Please run Voila with --debug to see the error message.

I try running “voila inference.ipynb --debug” to see what the error is, but get this back:

[Voila] Voila is running at:
WARNING | No web browser found: could not locate runnable browser

As a side note, I try this both on my local terminal where I SSH into my VM, and on the Cloud Console provided command line.

Nothing is running on port 8886 on local machine, which makes sense since I’m using Google Cloud. But I can’t navigate to wherever voila is running on the cloud. So, I decide to just pull the repo down to my local machine and try it there, but my notebook won’t run at all on my local machine because of this totally unrelated error:

NotImplementedError: cannot instantiate 'PosixPath' on your system,

which I read somewhere MIGHT be because I’ve been developing the notebook on Google Cloud, which is using a Unix virtual machine, and it won’t run because my local machine is windows.

So basically, I never got to find out why Voila won’t work, and I’ve been stuck on trying to deploy my model for 3 days.

Am I the only one having this many problems? Does anyone have a solution to any of these numerous problems?


Hi @wcneill,

I run into this same Problem but fixed that by running from shell: voila mywebapp0.ipynb
Basically voila nameofyournotebook and then copy the url you get into your web browser. I also notice that your code is slightly different your Jeremy note which has

display(VBox([ widgets.Label(‘Squash IT!’), btn_upload, out_pl, lbl_pred ]))

But display() is missing in your above code. Plus you have additional parameter ‘‘btn_run’’ . I am not sure if this make a difference or fix your your problem!

  1. Forward an additional port (8866) in your connection script to gcp instance.

  2. run voila from the command line in your gcp instance typing

voila yournotebook.ipynb

  1. on your local machine go to localhost:8866

You should be able to use the application on your local machine.

1 Like

Hi there

Did you manage to figure out the original issue with the deployment?
I can run voila locally and it all works fine locally but on mybinder.org I just get this error message for every cell:
“There was an error when executing cell [1]. Please run Voila with --debug to see the error message”
I created the notebook from scratch as there were some Colab bits in there, copied someone else’s notebook and just added my export file and still the same!
About to give up and try something else now.


You actually need the export.pkl file and the requirements.txt in your repo , the error that you have in cell one is because its trying to import the export.pkl file . my requrements.txt looks like this

1 Like

Can anyone confirm if Voila works on Colab?
I’m trying to run this line of code
!jupyter serverextension enable voila --sys-prefix
and getting this error:
Enabling: voila
- Writing config: /usr/etc/jupyter
- Validating…
Error loading server extension voila
X is voila importable?
How to fix this error?


This is what I have tried so far:

iypnb file:


2.- requirements

readme file

my github repo, which you can see here:

and my settings in binder

and I still get this error:

it still does not work/ do you see something wrong?

1 Like

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

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