alpacahq / alpaca-py

The Official Python SDK for Alpaca API
https://alpaca.markets/sdks/python/getting_started.html
Apache License 2.0
568 stars 140 forks source link

[Bug]: Incompatibility with Google Colab pre-installed dependencies #359

Closed alessiocastrica closed 8 months ago

alessiocastrica commented 1 year ago

Is there an existing issue for this?

Current Behavior

In Google Colab:

from alpaca.trading.client import TradingClient

image

Expected Behavior

Ideally there shouldn't be any dependencies conflict with the Colab default environment.

SDK Version I encountered this issue in

v0.12

Steps To Reproduce

1. Open Google Colab
2. Import anything from alpaca-py v0.11 or v0.12

Filled out the Steps to Reproduce section?

Anything else?

If you do not import the default typing-extensions before you import aplaca-py, there are no errors, for example by importing the latest verion of tensorflow (instead of the default colab one):

!pip install alpaca-py
import tensorflow
from alpaca.trading.client import TradingClient

Screenshot 2023-10-05 at 16 42 52

This behaviour is due to pydantic >= v2 requiring yping-extensions>=4.6.1

hiohiohio commented 11 months ago

https://colab.research.google.com/notebooks/relnotes.ipynb#scrollTo=BCnGH7WZuEoI

tensorflow 2.13.0 -> 2.14.0 tensorflow-probability 0.20.1 -> 0.22.0

tensorflow version was bumped to v2.14.0. However, tensorflow-probability 0.22.0 still requires typing-extensions<4.6.0. Seems we need to wait tensorflow-probability v0.22.1 to mark this issue resolved.

hiohiohio commented 8 months ago

Please let me close this issue as tensorflow-probability is upgraded to 0.23.0 on google colab. https://github.com/googlecolab/backend-info/blob/ecfb7fb7e53069170a9f90815b95556aa6cb61ec/pip-freeze.txt#L426