1

I created a Python script that works fine when I run it through Spyder. Basically, I'm querying some files and merging a couple data frames into one final data frame. All of this works perfectly fine. Then, I created an executable from this .py file, and I'm trying to run the .exe but it's giving me a problem. Here's the issue.

pkg_resources.DistributionNotFound: The 'google-cloud-bigquery' distribution was not found and is required by the application

So, basically, when I try to push the data frame into Google Big Query, this causes an error. It seems like 'google-cloud-bigquery' is not setup in the virtual environment. I followed the instructions from the link below to try to ensure everything is setup correctly.

https://cloud.google.com/python/setup

After going through all those steps, I'm still getting the error described above.

This is the line of code that causes the error:

df3.to_gbq(destination_table, project_id=proj_ID, if_exists='append')

Any thoughts on how to get this working?

ASH
  • 20,759
  • 19
  • 87
  • 200
  • Run: `pip install -U google-cloud-bigquery` – John Hanley Jan 22 '19 at 21:57
  • Thanks John. I tried what you suggested, re-ran the process, and got exactly the same results as before. I can completely understand if one system doesn't have permissions to communicate with another system, but I think it's weird that it's all Google-based and it doesn't work. Any other thoughts? – ASH Jan 23 '19 at 18:35
  • Your comment `I'm trying to run the .exe `. This is something that I have not tried, so I don't know. – John Hanley Jan 23 '19 at 18:54
  • I tried to do the same thing using a Google Cloud Function. I had similar errors. How would someone use GCP to run a Python script? I have seen a lot of documentation on this, but so far, I haven't been able to make anything work. – ASH Jan 23 '19 at 19:36
  • Very interesting comment. I do a lot of development (C#, Python and Node.js) for GCP and I seldom have problems. This indicates that your development environment is not setup correctly and / or when you upload your code you are not including everything (requirement.txt for Cloud Functions in Python, etc.). Without more details, I could only guess. For your Cloud Functions problem, create a new question. There are many of us that can help with that service and this will narrow down the problem and the solution. – John Hanley Jan 23 '19 at 19:40

1 Answers1

0

I upgraded pyinstaller, and my exe worked with google-cloud-bigquery. The bug was fixed with pyinstaller version 4.2.

pip install --upgrade pyinstaller

Cpend
  • 1