Skip to content
Advertisement

Not able to import pandas and numpy

I am trying to run following simple script on Debian Stable Linux:

JavaScript

But it is giving following error:

JavaScript

Following versions of pandas and numpy are installed through Debian Repositories:

JavaScript

Where is the problem and how can it be solved?


Edit: I find that the same above file works perfectly in another folder! I am using correct filename for command.

JavaScript

There are other files and sub-folders in first folder. One of which is __pycache__ which contains following files:

JavaScript

My datetime.py file has following:

JavaScript

Is it possible these are interfering?

Advertisement

Answer

Since the script was working well in other folders, the problem was in this folder only. There was a file named datetime.py in this folder, removal of which resolved the problem. Apparently, pandas looks for a file named datetime.py and searches first the current folder, where it finds this user file with same name. Hence the problem.

Moral of the story: User files should not be given general names that may be being used by software packages.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement