OSError: 'seaborn' is not a valid package style

How can i resolve this issue?

 

C:\Users\Home_PC\anaconda3\envs\quantra_py\lib\site-packages\scipy\__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.26.2
  warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File ~\anaconda3\envs\quantra_py\lib\site-packages\matplotlib\style\core.py:137, in use(style)
    136 try:
--> 137     style = _rc_params_in_file(style)
    138 except OSError as err:

File ~\anaconda3\envs\quantra_py\lib\site-packages\matplotlib\__init__.py:893, in _rc_params_in_file(fname, transform, fail_on_error)
    892 rc_temp = {}
--> 893 with _open_file_or_url(fname) as fd:
    894     try:

File ~\anaconda3\envs\quantra_py\lib\contextlib.py:117, in _GeneratorContextManager.__enter__(self)
    116 try:
--> 117     return next(self.gen)
    118 except StopIteration:

File ~\anaconda3\envs\quantra_py\lib\site-packages\matplotlib\__init__.py:870, in _open_file_or_url(fname)
    869 fname = os.path.expanduser(fname)
--> 870 with open(fname, encoding='utf-8') as f:
    871     yield f

FileNotFoundError: [Errno 2] No such file or directory: 'seaborn'

The above exception was the direct cause of the following exception:

OSError                                   Traceback (most recent call last)
Cell In[1], line 6
      4 from scipy.optimize import minimize
      5 import matplotlib.pyplot as plt
----> 6 plt.style.use('seaborn')

File ~\anaconda3\envs\quantra_py\lib\site-packages\matplotlib\style\core.py:139, in use(style)
    137         style = _rc_params_in_file(style)
    138     except OSError as err:
--> 139         raise OSError(
    140             f"{style!r} is not a valid package style, path of style "
    141             f"file, URL of style file, or library style name (library "
    142             f"styles are listed in `style.available`)") from err
    143 filtered = {}
    144 for k in style:  # don't trigger RcParams.__getitem__('backend')

OSError: 'seaborn' 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`)

Hi Pierre,



I am not able to replicate this issue. It is working fine in the quantra environment on my local system. This error might be due to a different version of seaborn/matplotlib on your system. I would suggest you please check the seaborn and matplotlib versions installed on your local system in the quantra environment. The seaborn version should be 0.11.2 or 0.12.2, and the matplotlib version should be 3.3.4. If this is not the case, you can try installing these version on your system or reinstalling the quantra environment from scratch.