I've run into a problem whilst writing a hedging algorithm in python in my conda environment.
Getting this message while debugging the file:
Exception has occurred: ModuleNotFoundError
No module named 'scipy'
File "/Users/michael/Library/Mobile Documents/com~apple~CloudDocs/Python/Algorithmic Multi-Greek Hedging.py", line 2, in <module>
from scipy.stats import norm
and From VSCode Terminal:
/Users/michael/opt/anaconda3/envs/snowflakes/bin/python "/Users/michael/Library/Mobile Documents/com~apple~CloudDocs/Python/Algorithmic Multi-Greek Hedging.py"
(base) michael@michaels-macbook-pro Python % /Users/michael/opt/a
naconda3/envs/snowflakes/bin/python "/Users/michael/Library/Mobil
e Documents/com~apple~CloudDocs/Python/Algorithmic Multi-Greek He
dging.py"
/Users/michael/Library/Mobile Documents/com~apple~CloudDocs/Python/Algorithmic Multi-Greek Hedging.py:19: SyntaxWarning: 'float' object is not callable; perhaps you missed a comma?
x1 = math.log(asset_price/(b*strike_price)) + .5(asset_volatility*asset_volatility)*time_to_expiration
Traceback (most recent call last):
File "/Users/michael/Library/Mobile Documents/com~apple~CloudDocs/Python/Algorithmic Multi-Greek Hedging.py", line 2, in <module>
from scipy.stats import norm
ModuleNotFoundError: No module named 'scipy'
I've already tried installing scipy through the Mac terminal, but it didn't solve anything.
Doublechecked for file placement, yet that seemed fine to me:
(base) michael@michaels-macbook-pro ~ % which pip
/Users/michael/opt/anaconda3/bin/pip
(base) michael@michaels-macbook-pro ~ % which python3
/Users/michael/opt/anaconda3/bin/python3
(base) michael@michaels-macbook-pro ~ % which scipy
scipy not found
(base) michael@michaels-macbook-pro ~ % pip install scipy
Requirement already satisfied: scipy in ./opt/anaconda3/lib/python3.9/site-packages (1.7.3)
Requirement already satisfied: numpy<1.23.0,>=1.16.5 in ./opt/anaconda3/lib/python3.9/site-packages (from scipy) (1.21.5)
(base) michael@michaels-macbook-pro ~ %
Any tips to overcome this?
Many thanks, M