Data Download Error in Yahoo finance

In qunatry_py Environment, I am getting the following error, tried a lot to fix it on my own by using chatgpt, but still unsuccessful. By upgrading one versions, some other library package is not working. Please help me on the below error

TypeError Traceback (most recent call last)
Cell In[1], line 6
4 import matplotlib.pyplot as plt
5 import warnings
----> 6 import yfinance as yf
7 import plotly.express as px
8 import plotly.graph_objs as go

File ~\anaconda3\envs\quantra_py\lib\site-packages\yfinance_init_.py:26
24 from .lookup import Lookup
25 from .ticker import Ticker
—> 26 from .calendars import Calendars
27 from .tickers import Tickers
28 from .multi import download

File ~\anaconda3\envs\quantra_py\lib\site-packages\yfinance\calendars.py:16
12 from .data import YfData
13 from .exceptions import YFException
—> 16 class CalendarQuery:
17 “”"
18 Simple CalendarQuery class for calendar queries, similar to yf.screener.query.QueryBase.
19
(…)
30 ```
31 “”"
33 def init(self, operator: str, operand: list[Any] | list[“CalendarQuery”]):

File ~\anaconda3\envs\quantra_py\lib\site-packages\yfinance\calendars.py:33, in CalendarQuery()
16 class CalendarQuery:
17 “”"
18 Simple CalendarQuery class for calendar queries, similar to yf.screener.query.QueryBase.
19
(…)
30 ```
31 “”"
—> 33 def init(self, operator: str, operand: list[Any] | list[“CalendarQuery”]):
34 “”"
35 :param operator: Operator string, e.g., ‘eq’, ‘gte’, ‘and’, ‘or’.
36 :param operand: List of operands: can be values (str, int), or other Operands instances (nested).
37 “”"
38 operator = operator.upper()

TypeError: unsupported operand type(s) for |: ‘types.GenericAlias’ and ‘types.GenericAlias’

Hi,

As you have rightly pointed out this error is due to a version incompatibility of yfinance library with other python libraries.
In the past, usually upgrading yfinance library worked. Code if you haven’t: pip install --upgrade yfinance

Since you have mentioned already upgrading the libraries, you must have also tried downgrading the yfinance library to version 0.2.50. In case you haven’t, you can try the following: pip install yfinance==0.2.50

We are looking at a stable version which will work, but in the meanwhile can you help with the following details:
OS Type, OS Version, Anaconda NAvigator version, Python version, and any errors you encountered in installing quantra_py environment.

We will update once we find a reliable solution.