I installed Anaconda with python 2.7.7.
However, whenever I run “import pandas” I get the error:
"ImportError: C extension: y not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first."
I tried running the suggested command but it stated that

skipping 'pandas\index.c' Cython extension (up-to-date)      
skipping 'pandas\src\period.c' Cython extension (up-to-date) 
skipping 'pandas\algos.c' Cython extension (up-to-date)      
skipping 'pandas\lib.c' Cython extension (up-to-date)        
skipping 'pandas\tslib.c' Cython extension (up-to-date)      
skipping 'pandas\parser.c' Cython extension (up-to-date)     
skipping 'pandas\hashtable.c' Cython extension (up-to-date)  
skipping 'pandas\src\sparse.c' Cython extension (up-to-date) 
skipping 'pandas\src\testing.c' Cython extension (up-to-date)
skipping 'pandas\msgpack.cpp' Cython extension (up-to-date)

Has anyone encountered this before and found a solution?

I was having the same problem now with Python 3.4.3.

I was using pandas-0.18.0.

Upgrading (using pip) solved the issue for me:

[sudo] pip install --upgrade pandas

The final result of the upgrade:

Successfully installed numpy-1.13.3 pandas-0.21.0 python-dateutil-2.6.1 pytz-2017.3 six-1.11.0

After this, the issue was gone!

Pandas has portions of its code written in C to make it run faster. If you tried to install pandas manually you would need to build it. Try reinstalling it with miniconda package manager here: http://conda.pydata.org/miniconda.html

and then you can just do

conda install pandas

There are very simple instructions on how to do it in the link below. Just do ctrl-f miniconda to find the section that talks about it

http://pandas.pydata.org/pandas-docs/dev/install.html

I had the same problem and the issue came from an encoding problem.
My os was previously set up in French and everything was fine. But then when I switched to English I had the error above.

You can type

locale

in the terminal to check the local environment variables.

When set up in French, I had this configuration:
French config.
Then, after I switched to English, I had:
English config.

I then added the following lines in the .bash_profile under /Users/myName and everything went back to normal.

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

I was having this problem with python 2.7.13
here is my solution:
1. install Cython with

pip install Cython

2. install g++ and gcc

apt-get install gcc, g++

3. uninstall pandas

pip uninstall pandas

4. reinstall pandas

pip install pandas

then everything will be OK.

I was unable to upgrade pandas with regular

pip install --upgrade pandas 

"tensorflow 1.6.0 has requirement numpy>=1.13.3, but you'll have numpy 1.13.1 which is incompatible."

However bumping it with:

pip install --upgrade pandas --force

solved issue completely

I tried all the solutions above, but nothing works out…

Error Message

I got an error message with ipython

ImportError: C extension: iNaT not built. If you want to import pandas 
from the source directory, 
you may need to run 'python setup.py build_ext --inplace --force' 
to build the C extensions first.

and it suggests

$ python setup.py build_ext --inplace --force

Solution

My suggestion: Be careful about the version issue!

I clone pandas from the official github repo, then build it myself and install by pip

Following is the command I typed in terminal

$ cd pandas

$ python setup.py build_ext --inplace --force

$ sudo pip install .  # don't forget the dot 

or, if you want to install in your personal Linux account instead of under the system (due to multiple users issue)

you can add --user flag

$ pip --user install . # don't forget the dot, too

Now, everything works fine on my laptop

My configuration

Ubuntu 16.04
Python 2.7
Numpy 1.13.1 

Good luck!

Instead of installing it with conda or pip, try to install it with your package manager:

sudo apt-get install python3-pandas

Actually, none of these answers worked for me in the following environment:

docker-compose # multiple containers, the managing one based on debian
Python 2.7
Django 1.8.19
numpy==1.11.3 # pinned to version, because of https://github.com/rbgirshick/py-faster-rcnn/issues/481

... more requirements

The following solution worked, after reading

https://github.com/pandas-dev/pandas/issues/18281

and

https://github.com/pandas-dev/pandas/issues/16715

which both addressed interim solutions and later recommended upgrading,

so I integrated into the Dockerfile

pip install -r requirements.txt \
&& pip install \
pandas==0.21.0 \
--force-reinstall \
--upgrade \
--no-deps \
--no-cache \
--find-links https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com/ \
--no-index

which is mentioned in https://github.com/pandas-dev/pandas/issues/16715#issuecomment-310063504

I tried all solutions mentioned here, except the accepted answer, also because a) I don’t want anaconda in a web production environment and b) it’s not a good answer to foster frameworks or cli-solutions for architectures, where a package is not used standalone…

Furthermore, I dislike @colo’s answer being downvoted, because it actually is a feasible solution in a certain environment.

For anyone finding this thread with similar requirements and expectations like me, I hope to have saved some minutes.

try

/miniconda3/bin/conda install python

python: 3.6.0-0 --> 3.6.1-2

and

/miniconda3/bin/conda install pandas

Try the same with your Anaconda version.

I had this issue when I needed up upgrade from Python 32 bit to 64 bit to use tensorflow.

Running this command uninstalled pandas 0.21 and reinstalled 0.22 :

pip install –upgrade pandas

Sorted.

I just had exactly the same issue when running tox.

Steps to solve:

  1. Update setup.py to contain pandas==0.23.0 (instead of 0.21.0).
  2. Remove .tox directory
  3. Run tox again.

upgrading pip solved the issue for me:

pip install --upgrade pip

Ok, I tried more than 20 differents way of install/uninstall, it was still not working. (conda and pip, –force –upgrade, ==THEGOODVERSION, etc…).

At the end I found that I had the wrong PATH…

Check this out if your out of options

So another problem that you may have and this was the case for me:
You may have multiple versions of Python on your system in different locations So even though you have pip installed everything up to date, it may be trying to interpret a version that hasn’t had that pip update applied.

So within your IDE say Visual Studio Code, check to be sure you are using the correct Python interpreter.

In VS Code you can find this by clicking on Python in the Left side of the bottom blue bar. If multiple interpreters show up, you may need to use those paths and uninstall all the others to eliminate the confusion.