PSCAD Automation Error using Python Script: "ModuleNotFoundError: No module named 'mhrc'"
I am using PSCAD 4.6.3 and have run the Automation Library installer. Python as been successfully installed. I am attempting to run the example code from PSCAD's website but I get the following error message in Python 3.7.2 Shell:
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> ============= RESTART: C:\... ...\step-00.py ============= Traceback (most recent call last): File "C:\... ...\step-00.py", line 2, in <module> import mhrc.automation ModuleNotFoundError: No module named 'mhrc'
The error is on th e line of code "import mhrc.automation". I'm not convinced that the Automation Library installer has placed the necessary library in the correct location. Unfortunately, I have found no references as to where it actually did get installed nor where it needs to be.
Status:
Open Feb 08, 2019 - 08:33 AM
Automation Library, mhrc, install
1answer
Answer
Mar 02, 2020 - 04:22 PM
I did not see an answer for this question so I will try to help.
Seems undefined path to the PSCAD Python library. Please make sure that Python is accesbile using the command line.
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
By
Same for me... I followed the document but ended up with this.
By
If you go to a command prompt and type "pip list" you will get a list of python modules installed on your global python environment. To get this in the global you need to run the "install-mhrc-automation.bat" file, which for me was in the "C:\Program Files (x86)\PSCAD\AutomationLibrary\463\Installs\PyAL" directory.
I would prefer to be able to run this from a virtual environment rather than polluting the global environment with too many packages, but I'm not sure if it's set up to do that. (I asked this question here: https://forum.hvdc.ca/4175249/Can-you-use-a-python-virtual-environment-for-mhrc-automation-PSCAD-Automation-package).
It does work with a python script called from a normal DOS shell (not in a venv or pipenv), but it didn't work until after I ran this batch file.
By
Oh, and you need to update your PATH variable to include all of the directories where python.exe (and pip.exe, for that matter) can come from. Either that or you need to give a full path to the python.exe file (or pip.exe) you want to use depending on which version of Python you wish to use, if you have multiple versions installed.
Add New Comment