I am getting this error meanwhile I was able to get rid of this same error during local deployment by simply changing the style. But since I cannot change that during deployment its throwing an error
Here is the github repo for refrence:
remove datetime
from your requirements file
try to use the master branch in your requirements file instead
do a reboot of the app
pyportfolioopt@git+https://github.com/robertmartin8/PyPortfolioOpt@master
opened 09:39PM - 11 Jan 24 UTC
closed 10:44AM - 18 Jan 24 UTC
bug
I am trying to import plotting method from pypfopt as follows:
`import yfinan… ce as yf
import pandas as pd
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
from pypfopt.efficient_frontier import EfficientFrontier
from pypfopt import risk_models, expected_returns, plotting
from pypfopt.discrete_allocation import DiscreteAllocation, get_latest_prices`
but I am getting the following error:
`FileNotFoundError Traceback (most recent call last)
File [~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:137](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:137), in use(style)
[136](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:136) try:
--> [137](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:137) style = _rc_params_in_file(style)
[138](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:138) except OSError as err:
File [~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:866](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:866), in _rc_params_in_file(fname, transform, fail_on_error)
[865](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:865) rc_temp = {}
--> [866](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:866) with _open_file_or_url(fname) as fd:
[867](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:867) try:
File [/usr/local/Cellar/python](https://file+.vscode-resource.vscode-cdn.net/usr/local/Cellar/python)@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:119, in _GeneratorContextManager.__enter__(self)
[118](https://file+.vscode-resource.vscode-cdn.net/usr/local/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:118) try:
--> [119](https://file+.vscode-resource.vscode-cdn.net/usr/local/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:119) return next(self.gen)
[120](https://file+.vscode-resource.vscode-cdn.net/usr/local/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:120) except StopIteration:
File [~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:843](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:843), in _open_file_or_url(fname)
[842](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:842) fname = os.path.expanduser(fname)
--> [843](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:843) with open(fname, encoding='utf-8') as f:
[844](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/__init__.py:844) yield f
FileNotFoundError: [Errno 2] No such file or directory: 'seaborn-deep'
The above exception was the direct cause of the following exception:
...
[142](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:142) f"styles are listed in `style.available`)") from err
[143](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:143) filtered = {}
[144](https://file+.vscode-resource.vscode-cdn.net/Users/tdafonseca/Desktop/6-Github/learning/portfolio-optimization/portfolio_notebooks/~/Desktop/6-Github/learning/portfolio-optimization/.venv/lib/python3.9/site-packages/matplotlib/style/core.py:144) for k in style: # don't trigger RcParams.__getitem__('backend')
OSError: 'seaborn-deep' is not a valid package style, path of style file, URL of style file, or library style name (library styles are listed in `style.available`)`
**Operating system, python version, PyPortfolioOpt version**
e.g MacOS 14.2.1, python 3.9.18, PyPortfolioOpt 1.5.5
Thanks for the help it worked
system
Closed
March 5, 2024, 5:09pm
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.