Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

google cloud job python polygon import

I am trying to run a python job that uses the polygon package. Locally I can pip install polygon and the code runs just fine. However the job(which has a requirements.txt that has polygon in it) fails on the google cloud.

I get this error.

ImportError: cannot import name 'RESTClient' from 'polygon' (/layers/google.python.pip/pip/lib/python3.11/site-packages/polygon/__init__.py)"

Does anyone know what is going on?

0 1 807
1 REPLY 1

- Not familiar with Polygon but are you sure there's a method/class/attribute called RESTClient? I see the following - StocksClient, ForexClient, StreamClient in the documentation

- Your issue could also be from the version used on your local machine versus the one installed by Google i.e. it's possible the version on your local machine has RESTClient but the version installed when you run on Cloud Run doesn't. One way to overcome this is to fix the version in your requirements.txt file

 

..... NoCommandLine ......
 https://nocommandline.com
A GUI for Google App Engine
Top Solution Authors