[GIS] Getting error while importing GeoPandas in Python console

geopandaspippython 3

I have installed GeoPandas and its dependencies using pip install package_name. Here is the pip list output:

Package Version


attrs 18.2.0
Click 7.0
click-plugins 1.0.4
cligj 0.5.0
cycler 0.10.0
descartes 1.1.0
Fiona 1.8.4
geographiclib 1.49
geopandas 0.4.0
geopy 1.18.1
kiwisolver 1.0.1
matplotlib 2.2.3
munch 2.3.2
numpy 1.15.4
pandas 0.22.0
pip 18.1
psycopg2 2.7.6.1
pyparsing 2.3.0
pyproj 1.9.5.1
PySAL 1.14.4.post2
python-dateutil 2.7.5
pytz 2018.7
Rtree 0.8.3
scipy 1.2.0
setuptools 40.6.3
Shapely 1.6.4.post2
six 1.12.0
wheel 0.32.3

But as soon as i am importing it in Python console as

import geopandas

I am getting an error as

Traceback (most recent call last): File "", line 1, in
File
"/home/rajesh/panda_projects/env/lib/python3.4/site-packages/geopandas/init.py",
line 1, in
from geopandas.geoseries import GeoSeries File "/home/rajesh/panda_projects/env/lib/python3.4/site-packages/geopandas/geoseries.py",
line 5, in
from pandas import Series File "/home/rajesh/panda_projects/env/lib/python3.4/site-packages/pandas/init.py",
line 26, in
from pandas._libs import (hashtable as _hashtable, File "/home/rajesh/panda_projects/env/lib/python3.4/site-packages/pandas/_libs/init.py",
line 4, in
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime File "pandas/_libs/src/numpy.pxd", line 865, in
init pandas._libs.tslib ValueError: numpy.ufunc has the wrong size,
try recompiling. Expected 192, got 216

What is the solution for this?

Best Answer

With tag python-3 in your question so you need pip3 instead pip. Package pip3, in Debian, is in python3-pip. Search for equivalent if you use a Debian based distro or another Linux distro. Afterward, install geopandas with:

pip3 install geopandas

At following image of QGIS 3 Python Console, it can be observed geopandas imported without any error:

enter image description here

Editing Note:

Install equivalent of following packages in your system and try again with geopandas.

sudo apt-get install build-essential python-dev libgdal-dev
Related Question