Problems with Python 3.9?

I have two Win10 PCs. One has Py 3.8.0 that I will call integration. The other has Py 3.9.0 that I will call development. Both have alpaca-trade-api==0.51.0 (pip freeze). The development box had Py 3.8.0 and worked fine until I upgraded to Py 3.9.0. Now I get 401 errors suggesting the same sandbox API keys I have always used are not valid. (Note that those keys continue to work on the integration box where nothing has changed - still Py 3.8.0.)

Before I do a clean install, my question is this: Is anyone else having issues with Py 3.9.0 and alpaca_trade_api? I don’t want to do a clean install of Py 3.9.0 and find that it still has problems with the API. In that case, I would rather do a clean install of 3.8.0 since I know that works.

error snippets:
barset = api.get_barset(FNG, ‘minute’, limit=5)
HTTPError: 401 Client Error: Unauthorized for url: https://data.alpaca.markets/v1/v1/bars/minute?symbols=
alpaca_trade_api.rest.APIError: key is not authorized for this data source (Code = 40110000)

First reset your API keys. If you have already done that then go ahead and make sure you have the latest version of the modules you are using. If that doesn’t fix it, then try updating Numpy. I had a problem like this and sometimes numpy likes to do weird things from my experience.

1 Like