So I’m building a tool for an analysis. The tool uses primarily pandas, numpy and a custom library that I created that is on PyPi called “PayEquity.”
My tool was working perfectly fine when I deployed it, then I started getting errors a few days later. I get some error from statsmodel.
TypeError: loop of ufunc does not support argument 0 of type float which has no callable sqrt method
This error usually happens when a dataframe is not all float. However, this error only happens when deployed, and the code runs perfectly fine locally so I don’t know how to reproduce it or fix it.
I am running out of ideas for how to fix this. I suspect this is some sort of package version mismatch that is causing misbehaviors. However, I have a requirements.txt file so I don’t know how this could happen. Any help would be greatly appreciated!
I can see that you are using a custom library called PayEquity. This library is not installed on the production server, so you are getting an error when you try to use it.
To fix this, you need to install the PayEquity library on the production server. You can do this by running the following command:
pip install PayEquity
Once you have installed the PayEquity library, you should be able to run your tool without any errors.
Here are some other things you can try:
Check the versions of the packages you are using. Make sure that they are the same versions that you are using locally.
Try running your tool in a virtual environment. This will help to isolate the dependencies of your tool and make it easier to troubleshoot problems.
The library is part of the requirement.txt file and I can see through the logs that it is getting properly installed. Moreover, when I run my code locally, it is ran in a virtual environment. My requirement.txt file is created from that same environment. Locally, there are absolutely no errors when running the tool.
I even tried uninstalling my custom package, and just placing the physical folder in my streamlit too repository and accessing them relatively. Again, locally it runs without any issues on a virutal environment. But as soon as it is deployed, I get an error in statsmodel.
Is there a way to export the streamlit environment file? i.e., create a requirements.txt from the streamlit app that is deployed, so that I can see exactly what is being installed, and how it compares to what I gave it?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.