error to import pandas library and numpy

Asked

Viewed 2,474 times

0

Guys, I have a problem to import panda library and numpy for my project, when I try to run on pycharm... the following code, this error presents:

code:

import pandas as pd

import numpy as np

error:

Traceback (most recent call last):
 File "/home/moises/Documentos/curso de python/Curso-Ciencia-de-Dados-master/Amostragem/amostragem1.py", line 1, in <module>
 import pandas as pd
 ModuleNotFoundError: No module named 'pandas'

Any suggestions?

  • And are these packages installed? How did you install it? What version of Python are you using?

  • @Andersoncarloswoss I downloaded the anaconda, but I don’t know what to do. Came a file with extension ". sh" (I’ve never seen this extension). My version of Pyhton is 3.7.

2 answers

4


Good morning, my friend, By what you are reporting the problem is not in pycharm but in the interpreter of the project. You must go on : File(File) -> Settings(Settings) -> Project(project) -> Interpreter(Interpreter)

In the window that opens just click on the gear and add the desired Python interpreter. In case you want to add some extra package just click on the icon of + or in the anaconda symbol below.

See if these changes solve your problem.

Hugs.

Imagem

  • Very good what you sent. But now, it does not give, the same error. In fact it does not give any error. In the Pycharm terminal, it returns this expression: "Process finished with Exit code 0". Having in the first line of my code the import of pandas 'import pandas as pd'. Include in this project, as you guided the packages, manually pandas and numpy, but now understand that it is not interpreting the code.

  • 1

    @Messages are only additional information provided by the IDE console. The script is running as expected. To say that the process ended with the output code 0 means that everything worked well. But if you want to see if the libraries are importing correctly try importing by the python shell present in pycharm itself and see if it can import these packages.

2

One way to find out what the problem is first is to know if you have these modules installed.

First use the command:

$ pip3 list

This command will list all modules installed on your machine.

You should now search in the list if there are these modules, they will be described with the same name numpy and pandas.

If you can’t find it execute the command:

$ pip3 install numpy && pip3 install pandas

Once done, check if the problem will persist.

  • 1

    I did not find them in the list as you indicated. So I installed as directed, but the error still continues. Any hints? And thank you for answering me!

  • @Moisesmoraes, when you care for the terminal also occurs this error or only in pycharm?

  • Only this giving error in pycharm and Spyder( I am trying too, but without success). The terminal works perfectly.

  • @Moisesmoraes, have tried to reinstall these programs and see what comes?

  • I’ve tried Spyder, but not pycharm!

  • try then! :)

  • Whoismatt, already tried the error persisted!

  • The mistake is in the pycharm... I’ll look for something and let you know if I find

  • Blz! I’ll see what I can do.

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.