No module named 'PySAM'

  • Zhaoyun Zeng
  • Topic Author
More
15 Apr 2024 14:28 #13082 by Zhaoyun Zeng
No module named 'PySAM' was created by Zhaoyun Zeng
Hi Paul,

I have successfully installed PySAM. By typing "pip list", I can see:

NREL-PySAM         5.1.0
NREL-PySAM-stubs   3.0.1

However, when I tried to run the following:

import PySAM.Pvsamv1 as pv

I got:

ModuleNotFoundError: No module named 'PySAM'

How can I solve this problem?

Regards,
Zhaoyun

Please Log in or Create an account to join the conversation.

  • Paul Gilman
More
15 Apr 2024 16:11 #13083 by Paul Gilman
Replied by Paul Gilman on topic No module named 'PySAM'
Hi Zhaoyun,

I think this is because of your Python environment. Perhaps you have more than one version of Python installed, or are running your script in a virtual environment that does not have access to the PySAM package you installed.

Please try searching the web for "ModuleNotFoundError" to see if you can find a solution.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • Zhaoyun Zeng
  • Topic Author
More
15 Apr 2024 18:56 #13085 by Zhaoyun Zeng
Replied by Zhaoyun Zeng on topic No module named 'PySAM'
Hi Paul,

Thanks for the quick response. Yes, your guess is correct.

My usual python installation directory is C:\Users\ladmin\AppData\Local\Programs\Python\Python311\Lib\site-packages. However, NREL-PySAM was installed in C:\Users\ladmin\AppData\Roaming\Python\Python312\site-packages. I used the same VS Code terminal to install PySAM. I don't why it is installed in the wrong directory. Do you know how to solve it?

Regards,
Zhaoyun

Please Log in or Create an account to join the conversation.

  • Paul Gilman
More
17 Apr 2024 19:49 #13096 by Paul Gilman
Replied by Paul Gilman on topic No module named 'PySAM'
Hi Zhaoyun,

You may want to set up Python virtual environment to manage your Python installation and packages. Some options are Python's `venv` or Anaconda's `conda`.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

Moderators: Paul Gilman
Powered by Kunena Forum