PyInquirer icon indicating copy to clipboard operation
PyInquirer copied to clipboard

ModuleNotFoundError: PyInquirer Not Detected in Virtual Environment

Open AmirAlSakban opened this issue 1 year ago • 1 comments

I'm encountering a ModuleNotFoundError when trying to run my Python script that imports PyInquirer. Despite having PyInquirer installed in my virtual environment, the script fails to recognize the module.

The error mesage is: Traceback (most recent call last): File "[Censored]", line 3, in import PyInquirer as Inquirer ModuleNotFoundError: No module named 'PyInquirer'

note: PyInquirer is correctly installed within the virtual environment. Python version: 3.12 Operating System: windows IDEs tested: vs code, pycharm The appropriate Python interpreter from the virtual environment is selected

AmirAlSakban avatar Apr 04 '24 18:04 AmirAlSakban

I'm encountering a ModuleNotFoundError when trying to run my Python script that imports PyInquirer. Despite having PyInquirer installed in my virtual environment, the script fails to recognize the module.

The error mesage is: Traceback (most recent call last): File "[Censored]", line 3, in import PyInquirer as Inquirer ModuleNotFoundError: No module named 'PyInquirer'

note: PyInquirer is correctly installed within the virtual environment. Python version: 3.12 Operating System: windows IDEs tested: vs code, pycharm The appropriate Python interpreter from the virtual environment is selected

Make sure that the script is using the correct Python interpreter associated with your virtual environment.

You can try the following :

  1. Activate Your Virtual Environment: Ensure that the virtual environment where you installed PyInquirer is activated in the terminal where you're running the script. You can activate it by running:

    source path_to_your_env/Scripts/activate  # On Windows
    

    After activation, you should see the virtual environment name in your terminal prompt.

  2. Verify the Package Installation: With the virtual environment activated, check if PyInquirer is installed by running:

    pip list
    

    or

    pip show PyInquirer
    

    If PyInquirer shows up in the list, it’s installed correctly. If it doesn't, you might need to reinstall it using pip install PyInquirer.

  3. Check Your IDE Settings:

    Since you're using VS Code and PyCharm, make sure that both are configured to use the Python interpreter from your virtual environment.

    In VS Code, you can check this by looking at the Python version displayed in the bottom-left corner of the window.

    In PyCharm, you can verify this in the project settings under "Python Interpreter."

hossam-elshabory avatar Aug 17 '24 23:08 hossam-elshabory