Error installing requirements with no explanation

I am receiving the following error…

" Error installing requirements.

The requirements.txt file is providing the following files…


I have the following imports in the code…

import streamlit as st
import pandas as pd
from googleapiclient.discovery import build
from google.oauth2 import service_account

Create a Google Authentication connection object

SCOPES = [‘’]

It’s unlikely that this is actually what you mean for requirements.txt, which means there won’t be a package from pip to install. A quick Google search suggests that you might mean something like



Thanks Randy,

I recall installing the packages, but how to import them through Google search was not considered. I went to the docs and don’t see there either. I appreciate if you have a direct link to your solution. Appreciate

The link above literally discusses how to use those libraries (assuming those are the Google libraries you need), starting at installation.

You would put the actual libraries in your requirements.txt file, not the subfolders you are trying to import such as build or service_account


OK, I have implemented the above Randy and I unfortunately having a bear of a time with the Cloud approach. My local is working perfectly and I have gone to the website to drop in the secret_file info. Can I provide you a link to my site for your observation? I would certainly appreciate it.

I am getting this following error…"Traceback:
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/”, line 354, in _run_script
exec(code, module.dict)
File “/app/pocket_option-strategy-analyzer/”, line 26, in
File “/home/appuser/venv/lib/python3.7/site-packages/google/oauth2/”, line 239, in from_service_account_file
filename, require=[“client_email”, “token_uri”]
File “/home/appuser/venv/lib/python3.7/site-packages/google/auth/”, line 72, in from_filename
with, “r”, encoding=“utf-8”) as json_file:


Do you have a working example of a GoogleSheet working with the Streamlit Cloud? I have experienced everything else working nicely, but not this scenario.



I thought I would look for a working example of this scenario in the community and it does not appear to be anywhere even as a effort. I see the effort for using Google Sheets, but not on the Streamlit Cloud Share, just in the docs with a localhost implementation.

Appears to be localhost not Streamlit Cloud


Yes, this is probably the best way to proceed.

The Google Sheet example being localhost isn’t the issue, as Streamlit Cloud is just a different place “localhost”.

Thanks Randy,

Here is access to my code.

Davis Rogers M.S.M.E.

Class A BLD

If you click on the bottom right, you can open the logs. Here’s what I see:

Successfully installed cachetools-4.2.4 certifi-2021.10.8 charset-normalizer-2.0.7 google-api-core-2.2.2 google-api-python-client-2.31.0 google-auth-2.3.3 google-auth-httplib2-0.1.0 google-auth-oauthlib-0.4.6 googleapis-common-protos-1.53.0 httplib2-0.20.2 idna-3.3 oauthlib-3.1.1 protobuf-3.19.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pyparsing-3.0.6 requests-2.26.0 requests-oauthlib-1.3.0 rsa-4.7.2 setuptools-59.1.1 six-1.16.0 uritemplate-4.1.1 urllib3-1.26.7

WARNING: You are using pip version 21.1.1; however, version 21.3.1 is available.

You should consider upgrading via the '/home/appuser/venv/bin/python -m pip install --upgrade pip' command.

[manager] Python dependencies were installed from /app/pocket_option-strategy-analyzer/requirements.txt using pip.

[manager] Processed dependencies!

2021-11-17 15:51:58.871 Uncaught app exception

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/pocket_option-strategy-analyzer/", line 26, in <module>


  File "/home/appuser/venv/lib/python3.7/site-packages/google/oauth2/", line 239, in from_service_account_file

    filename, require=["client_email", "token_uri"]

  File "/home/appuser/venv/lib/python3.7/site-packages/google/auth/", line 72, in from_filename

    with, "r", encoding="utf-8") as json_file:

FileNotFoundError: [Errno 2] No such file or directory: 'keys.json'

[client] Connecting...

The library is trying to read a file that doesn’t exist in your Git repo. I would guess it’s this line here:


Oh Wow Randy,

Ok, Awesome.

I saw this in the error, and I placed the file in the same folder so the path would not be necessary, however, I guess I have to place this in the .streamlit folder and upload that to Github ?

Davis Rogers M.S.M.E.

Class A BLD

Hi Randy,

Thanks for your insight on this. It’s getting pretty exciting to be approaching the finish line on this.

Please clarify this view of where I am currently at.

I see where you can place secrets for a local .streamlit folder, however for a Cloud hosting I don’t see how to hide the key.json file in GitHub. I am thinking to just upload the .streamlit folder and reference the file?
Do you have a example of what this looks like in the docs ?

How to Deal with Secrets


Davis Rogers M.S.M.E.

Class A BLD

You wouldn’t commit the file to GitHub, because then the values would be publicly accessible to anyone. Instead, you use the secrets management piece to pass in those values.

What this implies though is that you’ll likely need to change the method you use for your authentication (that I highlighted before), not to read from a file but instead pass those arguments directly. In your Python code, you would call the secret value (so it wouldn’t be accessible to everyone), but Python would swap in those values and make your app work.


OK, I see what you are saying, but how to implement is really challenging for me. So I currently have a variable (SERVICE_ACCOUNT_FILE) holding the path of where my file is.
This path is being used in a function,
creds = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)

How do I pass the different components within the file to the places they being used in the function.

I am glad you are helping me to see the issue. I am starting to see the problem, but how to apply your solution is beyond me. lol Hint please…

Oh, now I hear what you are saying, but is that a Oautho2 approach ? What method can work for this type of challenge ?

To me this sounds like a totally different Python Library to build out the code.
Or is it a simple adjustment of existing code ?

This also appears to need a .toml file, not a .json file. Am I on the write track with this ? I do appreciate your thoughts, because I was a little challenged with this and not sure if I needed to scrap my code and build from scratch or if there is a way to make this work with a minor adjustment to existing code. I am scratching my head, lol

This might be a Python library that could use the .toml file instead of the .json file. I have to explore this a solution.

Introduction to gspread_pandas

Here is another solution that works on the localhost, but I will test this now to see if it works on Streamlit Cloud.

STREAMLIT PYTHON WEB APP connected to GOOGLE SHEET as DATABASE | Automate Google Spreadsheets

You would find an equivalent function to creds = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES), but that takes the arguments directly.

In this example, we show how to add your credentials through the Streamlit Cloud secrets interface:

And how to authenticate assuming that you are using Streamlit Cloud:

import streamlit as st
from google.oauth2 import service_account
from gsheetsdb import connect

# Create a connection object.
credentials = service_account.Credentials.from_service_account_info(
conn = connect(credentials=credentials)



Thank You

This is such jewel of an answer for this question.
I hope I asked the question properly because to have such an eloquent solution makes me feel I did not ask the correct question.

Please advise on what the question should look like so I can properly Notate my code for the Public.