0
votes

I use VSCode to write python scripts about gateway and created a project. This project needs to use pandas to generate and read Excel.Now, I have installed pandas with pip.I have simply written a demo to test to generate and read Excel, but when the code is integrated, run the code and display ModuleNotFoundError: No module named 'pandas'

I use pip list to display module, when i run the project,Only a part of modules are displayed after pip, and there is no pandas, but when I run a demo, he displays many modules, including pandas. how to solved it? enter image description here

enter image description here

4
Thanks for your answers,at now, i have solved this problem,because the gateway have itself python SDK,if i want to Remote debugging gateway,i must update SDK.i need connect FAE and give me Authority to pip install pandas.Melvyn Gu

4 Answers

0
votes

I would uninstall pandas with pip and download anaconda which contains pandas, numpy, and lots of other very useful data science tools. Just open vs code, select the conda python interpreter, and everything should run smoothly. Conda ensures all your data science software works together and gets continual updates. It will download a separate version of python so make note of that in the PATH variables if you want your computer to use conda as the main python interpreter.

0
votes

I think there are already many posts related to this problem. I think you should go through all that. I am leaving the link of a relatable post here. You should also check if you have selected correct python interpreter.

If you have already gone through all that, let us know.

VS Code: ModuleNotFoundError: No module named 'pandas'

0
votes

You could be in a virtual environment in the project. Check which python interpreter is in use.

(Click on Python button lower left hand corner.)

Once you have the right python environment selected, just for good measure, install pandas once again, possibly from the vs code terminal. pip install Press Alt+` to start terminal

Sometimes when there are more than one python installations available incorrect order of python and python\scripts or python\bin can throw off the import statements. you can run python -m pip install pandas to install pandas in same env from which python is picked.

0
votes

First picture: pip 21.1.1

Second picture: pip 19.0.3

Obviously, your project and the demo running in different environments.

From the picture you provided, it seems like the project using the global python environment.

You can try to install the packages in the global environment. But it's recommended to create a virtual environment instead.

If you not familiar with the virtual environment you can refer to here