Deploying app with fonctions dependencies and multiple python scripts files

Hi everyone,

First, I’d like to say that I am happy to be here, I just discover streamlit and it seems to be a incredible tools but I might not have understand something.

I built my application using 5 différents files. The app is about NBA datas and is composed of 3 parts:

  • The first one is calling fonctions using beautiful soup and pandas to build and display some dataframes but nothing comes out when I Iaunch a research . It was perfectly working in local and I don’t get any error.
  • The second part is using fonctions with sklearn models. It was also working before the deployement and it gives me this message now :
    AttributeError: Can’t get attribute ‘PolynomialFeatures’ on <module ‘sklearn.preprocessing._data’ from ‘/home/appuser/venv/lib/python3.7/site-packages/sklearn/preprocessing/’>
  • The last part is also using a fonction with this type of model and gives me this message :
    raise ValueError(“All objects passed were None”).
    For this last error, I’ve already seen it while I was testing my app before deployment and I fixed it but it looks like it’s still a problem.

I was wondering if I did something wrong when I built my app that causes these errors. If you want to check by yourself, here is the link :

Of course, I did a requirements files with all the dependecies but nothing seems to work.
Thank you and sorry because the app is all in french btw


Hi @BastienChicot, welcome to the Streamlit community!

I get the following error from ‘Projections individuelles’

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/", line 354, in _run_script

    exec(code, module.__dict__)

  File "/app/nbapp_streamlit/", line 19, in <module>


  File "/app/nbapp_streamlit/", line 90, in onglet_prediction


  File "/app/nbapp_streamlit/Services/", line 118, in calcul_predictions

    df1['FGA_pred'] = MLP.predict(FGA)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/utils/", line 119, in <lambda>

    out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/", line 407, in predict

    Xt = transform.transform(Xt)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/compose/", line 604, in transform

    Xs = self._fit_transform(X, None, _transform_one, fitted=True)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/compose/", line 467, in _fit_transform

    self._iter(fitted=fitted, replace_strings=True), 1))

  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 1048, in __call__

    if self.dispatch_one_batch(iterator):

  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 866, in dispatch_one_batch


  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 784, in _dispatch

    job = self._backend.apply_async(batch, callback=cb)

  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 208, in apply_async

    result = ImmediateResult(func)

  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 572, in __init__

    self.results = batch()

  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 263, in __call__

    for func, args, kwargs in self.items]

  File "/home/appuser/venv/lib/python3.7/site-packages/joblib/", line 263, in <listcomp>

    for func, args, kwargs in self.items]

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/", line 719, in _transform_one

    res = transformer.transform(X)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/", line 549, in _transform

    Xt = transform.transform(Xt)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/preprocessing/", line 1551, in transform

    accept_sparse=('csr', 'csc'))

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/utils/", line 72, in inner_f

    return f(**kwargs)

  File "/home/appuser/venv/lib/python3.7/site-packages/sklearn/utils/", line 598, in check_array

    array = np.asarray(array, order=order, dtype=dtype)

  File "/home/appuser/venv/lib/python3.7/site-packages/numpy/core/", line 83, in asarray

    return array(a, dtype, copy=False, order=order)

  File "/home/appuser/venv/lib/python3.7/site-packages/pandas/core/", line 1781, in __array__

    return np.asarray(self._values, dtype=dtype)

  File "/home/appuser/venv/lib/python3.7/site-packages/numpy/core/", line 83, in asarray

    return array(a, dtype, copy=False, order=order)

**ValueError: could not convert string to float:** 

In this case, Python doesn’t know how to auto-convert a string into numeric. Since you are likely passing a value in from the multi-select box, you should ensure that you are doing the string-to-number conversion yourself to make sure there aren’t any type mismatches.


Oh ok thank you. I’ll check that.
By the way, someone help me with the logs of the app but wasn’t able to tell me why the first page doesn’t work.

Thank you very much for this, I realised that selectbox needed to be transform as string or int before getting pass to a function.

1 Like

OK I will switch this subject, now I clearly know that the problem comes from beautiful soup 4 or the way my functions are written because the chart I display from basketball reference aren’t showing up on the first page and I test without them and the app is working.
I got to find out that now

1 Like

If it would help, we’ve got the #streamlit-fr channel on our Discord, if it would make it easier for you to find someone in the community to help: