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 impo
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!
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 tried all the solutions above, but nothing works out...
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
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
Ubuntu 16.04
Python 2.7
Numpy 1.13.1
Good luck!
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.
Instead of installing it with conda or pip, try to install it with your package manager:
sudo apt-get install python3-pandas