pythonexcelpvlib

Python in Excel - Importing pvlib library


I'm interested in combining Python in Excel with the pvlib library. However, beginning a Python statement with "import pvlib" is not working.

I get a ModuleNotFoundError: No module named 'pvlib'

Does anyone know what steps need to be taken to get pvlib to work in Python in Excel? I have been able to get other basic Python code working.

This page says that libraries can be imported, but I don't think pvlib is a native Anaconda library so perhaps it isn't one of the libraries available to be imported?

Thank you


Solution

  • From the Introduction to Python in Excel, at the Python runs in the cloud section, you can read (emphasis mine)

    Python in Excel calculations run in the Microsoft Cloud with a standard version of the Python language. Python in Excel comes with a core set of Python libraries provided by Anaconda through a standard, secure distribution. [...]

    You don't need a local version of Python to use Python in Excel. If you have a local version of Python installed on your computer, any customizations you've made to that Python installation won’t be reflected in Python in Excel calculations.

    As pvlib is not listed in the libraries at the link you posted, it looks like it is not available for Python in Excel use.

    With regard to your hypothesis that

    I don't think pvlib is a native Anaconda library so perhaps it isn't one of the libraries available to be imported

    It is only partially correct. pvlib is available for conda installation on a local Python installation, but is not available for use in Python Excel.

    Hope this helps!