Skip to content Skip to sidebar Skip to footer

Pandasql Will Not Import : ImportError: Cannot Import Name To_sql

I installed pandasql with pip at the linux command prompt, and started ipython notebook: felix@xanadu ~ $ sudo pip install pandasql [sudo] password for felix: Downloading/unpackin

Solution 1:

You should definitely upgrade to pandas 0.16.0:

sudo pip install -U pandas

I just looked through the source code of pandas/io/sql.py in 0.13.1 and 0.16.0, and the to_sql() and read_sql() methods are not present in the older version, while they exist in the latest version.


To summarize our conversation in the comments, in order to successfully build pandas, you will need to install the gcc, g++, and python-dev packages from your system's package manager (apt-get, yum, zypper, whatever). If you are building for Python 3, the python3-dev package is needed.

If you are using Windows and the standard python.org version of Python, the easiest way to keep your packages up to date is to use Christoph Gohlke's Python Extension Packages for Windows repository. Many packages depend on his MKL-linked version of numpy, including pandas. The nice thing about all of these packages is that they are pre-compiled against both 32- and 64-bit versions of Python, and are generally available for Python 2.7, 3.3, and 3.4 (depending on the package, of course - some haven't been ported to Py3 yet). They are available in .whl format, so installation/upgrading is as easy as

pip install -U name_of_package.whl

Post a Comment for "Pandasql Will Not Import : ImportError: Cannot Import Name To_sql"