admin管理员组

文章数量:1122791

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

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

Share Improve this question edited Nov 22, 2024 at 17:59 Luca 6334 silver badges14 bronze badges asked Nov 21, 2024 at 22:53 Jonathan S.Jonathan S. 32 bronze badges 5
  • Install it then using Conda or Pip or whatever application you use. – moken Commented Nov 22, 2024 at 1:30
  • @moken I guess the OP refers to the Excel features that allow using Python snippets inside Excel cells, not to "standard" Excel manipulation via Python. Based on the docs, with particular reference to Python runs in the cloud section, I think your answer applies only to the latter case. – Luca Commented Nov 22, 2024 at 14:13
  • Also in the OPs link it says In addition to the core libraries, you can import additional libraries available through Anaconda. Import Python libraries into Excel using a Python import statement in a Python in Excel cell, such as import numpy as np. This statement imports the NumPylibrary and assigns it the alias np. After entering this import statement into a Python cell, you can refer to the NumPy library as np throughout the Python formulas in that workbook. – MT1 Commented Nov 22, 2024 at 15:20
  • and there's more Tip: To ensure that your libraries are imported before your Python formulas run, enter your import statements and any settings on the first worksheet in your workbook. If desired, you can reserve the first worksheet specifically for the import statements and settings. – MT1 Commented Nov 22, 2024 at 15:21
  • unfortunately pvlib is not mentioned but it could be worth a try – MT1 Commented Nov 22, 2024 at 15:22
Add a comment  | 

1 Answer 1

Reset to default 0

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!

本文标签: Python in ExcelImporting pvlib libraryStack Overflow