Mac M1 Paython - RuntimeError: can't start new thread

Hello all!

I am not a programmer and my knowledge is very poor on this topic.

My task is to upload historical data from Yahoo Finance.

For this I use Python and specifically the yf.download library

The code is correct, since everything works for my teacher, BUT! he uses a Windows PC, I have a MacBook Pro (M1 2020 8 GB RAM).

It is necessary to upload data on 4933 stocks, and when it comes to about 2000, the process stops and does not go any further.

RuntimeError: can't start new thread occurs

I think that the problem is in the computer (it is logical to assume).

If anyone knows how to get around this (without changing the computer), please write. I'll be very grateful.

code below:

nasdaq_stocks = yf.download(tickers = nasdaq_tickers, period = 'max', interval = '1d', group_by = 'ticker')

result:

[ 0% ] 13 of 4933 completed

RuntimeError Traceback (most recent call last) Input In [25], in <cell line: 1>() ----> 1 nasdaq_stocks = yf.download(tickers = nasdaq_tickers, period = 'max', interval = '1d', group_by = 'ticker')

File ~/opt/anaconda3/lib/python3.8/site-packages/yfinance/multi.py:105, in download(tickers, start, end, actions, threads, group_by, auto_adjust, back_adjust, progress, period, show_errors, interval, prepost, proxy, rounding, timeout, **kwargs) 103 _multitasking.set_max_threads(threads) 104 for i, ticker in enumerate(tickers): --> 105 _download_one_threaded(ticker, period=period, interval=interval, 106 start=start, end=end, prepost=prepost, 107 actions=actions, auto_adjust=auto_adjust, 108 back_adjust=back_adjust, 109 progress=(progress and i > 0), proxy=proxy, 110 rounding=rounding, timeout=timeout) 111 while len(shared._DFS) < len(tickers): 112 _time.sleep(0.01)

File ~/opt/anaconda3/lib/python3.8/site-packages/multitasking/init.py:119, in task..async_method(*args, **kwargs) 116 single = config["POOLS"][config["POOL_NAME"]]['engine']( 117 target=_run_via_pool, args=args, kwargs=kwargs) 118 config["TASKS"].append(single) --> 119 single.start() 120 return single

File ~/opt/anaconda3/lib/python3.8/threading.py:852, in Thread.start(self) 850 _limbo[self] = self 851 try: --> 852 _start_new_thread(self._bootstrap, ()) 853 except Exception: 854 with _active_limbo_lock:

RuntimeError: can't start new thread

[****************** 41% ] 2033 of 4933 completed**

I got the same problem. Did you find any solution?

Mac M1 Paython - RuntimeError: can't start new thread
 
 
Q