Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation Error : Database is Locked. #1689

Closed
talk2jaydip opened this issue Sep 21, 2023 · 8 comments
Closed

Operation Error : Database is Locked. #1689

talk2jaydip opened this issue Sep 21, 2023 · 8 comments

Comments

@talk2jaydip
Copy link

talk2jaydip commented Sep 21, 2023

Describe bug

While using yfinance from docker container, throwing Error saying Operation Error: Database is locked
ticke size is 100 symobls at time

# Define a function that takes a list of tickers and returns a DataFrame
def download_data(ticker=None):
    try:
        time.sleep(2)
        data = yf.download (tickers=ticker,group_by="Ticker", period="60d", interval="1h",proxy=None)
        
        return data

Simple code that reproduces your problem

give above

Debug log

AS shown above

Bad data proof

No response

yfinance version

latest

Python version

3.7

Operating system

ANY

@ValueRaider
Copy link
Collaborator

ValueRaider commented Sep 21, 2023

Try main branch #1080, it has relevant changes that should fix #1675.

If you confirm fix, I'll send out release asap

@talk2jaydip
Copy link
Author

@ValueRaider :

Tried out this inside docker:
pip install git+https://github.com/ranaroussi/yfinance.git@main

image

@talk2jaydip
Copy link
Author

FYI:

    # Create a pool of processes with the number of CPU cores available
    with concurrent.futures.ProcessPoolExecutor(max_workers=mp.cpu_count()) as executor:
        for c in itertools.islice(tasks,mp.cpu_count()-1):
            c = [stock for stock in c if stock not in failed_list_yf]
            futures.update({executor.submit(  download_data,list(c)  ): c[0]})

@ValueRaider
Copy link
Collaborator

So you're running multiple processes, not just threads?

@talk2jaydip
Copy link
Author

YES... to make process other signal based on latest value. otherwise would take long time.
Issue is while running with Thread/Process PollExecutors

@ValueRaider
Copy link
Collaborator

yf.download in a loop = ‼️ Maybe rethink why do this. Maybe you need https://pypi.org/project/yfinance-cache/

@talk2jaydip
Copy link
Author

Not in a loop, in simple terms sending 100 symbols at a time, so with multiprocessing sending 8 req at time so that can be downloaded parallelly.

Thanks for sharing yf-cache, i will look into it.

@ValueRaider
Copy link
Collaborator

ValueRaider commented Sep 21, 2023

multiprocessing sending 8 req at time

‼️ download is already parallel.

@ValueRaider ValueRaider closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants