0

I am encountering an issue while trying to run a Python script. The error message is 'ModuleNotFoundError', specifically related to the 'pandas' library. I have installed 'pandas' using pip, but the script still fails to recognize the module. I'm seeking guidance on resolving this import error.

I have installed 'pandas' using the command pip install pandas in my virtual environment. I verified the installation with pip show pandas, which displayed the correct version. However, when running my Python script, I receive the error 'ModuleNotFoundError: No module named 'pandas''. I expected the script to execute without any import-related issues after successfully installing 'pandas'.

4
  • Did you activate your virtual environment and then launched your script from there ? Have you tried running simply python from your venv and running command import pandas ? Commented Jan 15, 2024 at 15:43
  • How, exactly, are you running the code? What is the exact command? Are you using an IDE? Commented Jan 15, 2024 at 15:49
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Jan 15, 2024 at 19:45
  • I am having the same issue with numpy. If i have to create a virtual enviroment to fix it, why i am be able to download globally. I didn't understand the point. Did you solve your problem? Commented Feb 2, 2024 at 13:35

1 Answer 1

0

The problem is that you are using a virtual environment. That is for users who work on multiple isolated projects simultaneously. Most people only need one normal environemnt.

How to resolve:

  1. Uninstall the virtual environment.

  2. Install python to your system (if not already installed).

  3. Install packages to your normal environment

  4. Run the code in the normal environment

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.