user3098731
user3098731

Reputation: 1

Trouble running Pandas library in Python

I am trying to run a program I forked off of Github (I will link it if needed to solve this problem)

Basically, the program just has one python file, which I should be able to run. In order to run, there were some other libraries I needed, such as SciKit-Learn. MOst of these seem to be fine, but one of them (Panda 0.8.1) doesn't seem to work. I installed panda just like all the other libraries, and did it a few more times to make sure.

When I try to run the python file, this is the error code I get:

  File "C:\Python27\lib\site-packages\pandas\__init__.py", line 15, in <module>
raise ImportError('C extensions not built: if you installed already '
ImportError: C extensions not built: if you installed already verify that you ar
e not importing from the source directory

How do I avoid whatever it is that I'm doing wrong?

Thanks!

Upvotes: 0

Views: 543

Answers (2)

Jon
Jon

Reputation: 12864

Yeah, building from the source sometimes can be troublesome. Just use a binary version which you can download e.g. from the pandas website:

Another great possibility is to use a package manager like pip. A one liner in the terminal saves the day (http://www.pip-installer.org/en/latest/installing.html):

pip install pandas

Maybe you already changed to Linux - if so, the simplest way is like for Ubuntu:

sudo apt-get install python-pip
sudo pip install pandas

Upvotes: 0

Steve Barnes
Steve Barnes

Reputation: 28370

Presumably you installed pandas from source. Your problem is that the pandas library - like quite a few others - includes C extensions, on Linux installing from source, i.e. downloading .zip or .tar.gz files, unpacking them and running python setup.py install is all you need to do to get the .c source compiled because everybody already has the necessary tools. On windows you either need to build the C code informing the system that you do have appropriate tools, (after you have got them), or get the built tools from somewhere else.

If you uninstall pandas and go here then locate the pre-built pandas that matches your operating system, python version, etc., download it an run it then your problem should go away.

In general there are two ways of avoiding ever getting this sort of problem:

  1. Look to see if there is a windows installer for the package you are downloading or
  2. Use a sensible OS like Linux

Upvotes: 1

Related Questions