On 6/9/25 20:15, Marc Shapiro via Dng wrote:
> A while back, I posted about issues with using yfinance and python's
> virtual environments. I was having problems with getting the venv to
> work, even though it seemed fairly straightforward. I ended up
> rewriting the python scrips to avoid using yfinance to get around the
> problem.
>
> I decided, however, that I really should get venvs working for the
> next time that I write something in python. So I created a venv and
> installed yfinance in it. As expected, it pulled in a slew of other
> packages. I copied the old version of my program (that requires
> yfinance) into the directory containing the venv and tried to run it.
> The results are as follows:
>
> ---------- First, it says that it can't find curl_cffi ----------
>
> ModuleNotFoundError: No module named 'curl_cffi'
>
> What am I doing wrong? It seems like everything should be working,
> now, but it isn't.
>
> Marc
I don´t see anything wrong with what you did, I just did the same in my
system (daedalus) and a simple yfinance program runs.
Have you tried with uv?
https://docs.astral.sh/uv/
A program to get a ticker with uv and yfinance:
----snip----
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = "~=3.13"
# dependencies = [
# "yfinance",
# ]
# ///
import yfinance as yf
ticker = 'AAPL'
data = yf.download(ticker, start='2024-01-01', end='2025-01-01')
print(data.info())
print(data.head())
----snip----
I put that in a file, and made it executable, then ran it.
It returns this:
FutureWarning: YF.download() has changed argument auto_adjust default to
True
data = yf.download(ticker, start='2024-01-01', end='2025-01-01')
[*********************100%***********************] 1 of 1 completed
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 252 entries, 2024-01-02 to 2024-12-31
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 (Close, AAPL) 252 non-null float64
1 (High, AAPL) 252 non-null float64
2 (Low, AAPL) 252 non-null float64
3 (Open, AAPL) 252 non-null float64
4 (Volume, AAPL) 252 non-null int64
dtypes: float64(4), int64(1)
memory usage: 11.8 KB
None
Price Close High Low Open Volume
Ticker AAPL AAPL AAPL AAPL AAPL
Date
2024-01-02 184.290405 187.070052 182.553128 185.789422 82488700
2024-01-03 182.910507 184.528662 182.096461 182.880727 58414500
2024-01-04 180.587540 181.758954 179.565029 180.825785 71983600
2024-01-05 179.862823 181.431339 178.860172 180.666948 62303300
2024-01-08 184.210983 184.250701 180.180502 180.766209 59144500
>
> _______________________________________________
> Dng mailing list
> Dng@???
> Manage your subscription:
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
> Archive: https://lists.dyne.org/lurker/list/dng.en.html
--
Hector Gonzalez
cacho@???