No module named 'PySAM'

  • rhodria1
  • Topic Author
More
15 Apr 2024 08:28 #13082 by rhodria1
No module named 'PySAM' was created by rhodria1
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.

  • pgilman
More
15 Apr 2024 10:11 #13083 by pgilman
Replied by pgilman 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.

  • rhodria1
  • Topic Author
More
15 Apr 2024 12:56 #13085 by rhodria1
Replied by rhodria1 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.

  • pgilman
More
17 Apr 2024 13:49 #13096 by pgilman
Replied by pgilman 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: pgilman
Powered by Kunena Forum