garrettj403 / SciencePlots

Matplotlib styles for scientific plotting
MIT License
6.96k stars 700 forks source link

OSError: 'science' not found in the style library #85

Closed rmastand closed 1 year ago

rmastand commented 1 year ago

I am using SciencePlots 2.0. While I am including

import scienceplots
import matplotlib.pyplot as plt
plt.style.use('science')

in my header, I'm still getting the error OSError: 'science' not found in the style library and input is not a valid URL or path; seestyle.availablefor list of available styles .

echedey-ls commented 1 year ago

Sorry, I can't reproduce given that. Are you sure you are using the version v2.x.x? Check version with python3 -m pip show scienceplots Upgrade with python3 -m pip install --upgrade scienceplots

Does it work for you?

echedey-ls commented 1 year ago

Also, check you installed SciencePlots in the same Python as your notebook or IDE is using. Do python3 -V to show the version of the python the console is running, and check the configuration of VSCode, Jupyter, whatever you use to match it, or run a script with

import sys
print(sys.version)

to show it.

If the problem persists, remember to share your device OS, Python version and whatever else you think might help us. I believe the problem is that there are many Python distributions installed on your system, and you are installing on one the v2.x.x which shouldn't have that problem; and the IDE you use is picking one that hasn't the newer SciencePlots.

This links should give you a hint to know if that might be the cause.

echedey-ls commented 1 year ago

Could you solve it?

rmastand commented 1 year ago

Hi all -- the issue was actually due to path confusion with my latex distribution. All is working!

echedey-ls commented 1 year ago

Glad to hear that! I didn't know that could be the cause, everyday I learn something new. Thanks!