Skip to content

importing pandas breaks after successfully installing pandas with pip #16715

Closed
@rvernica

Description

@rvernica

Code Sample, a copy-pastable example if possible

> docker run --tty --interactive --rm python:2.7.12-alpine ash
/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
v3.4.6-150-gf952adf [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.6-83-g67e50bc [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
OK: 5983 distinct packages available
/ # apk add cython g++ musl-dev
(1/21) Upgrading musl (1.1.14-r12 -> 1.1.14-r14)
(2/21) Installing libffi (3.2.1-r2)
(3/21) Installing python (2.7.12-r0)
(4/21) Installing cython (0.24-r1)
(5/21) Installing libgcc (5.3.0-r0)
(6/21) Installing libstdc++ (5.3.0-r0)
(7/21) Installing binutils-libs (2.26-r1)
(8/21) Installing binutils (2.26-r1)
(9/21) Installing gmp (6.1.0-r0)
(10/21) Installing isl (0.14.1-r0)
(11/21) Installing libgomp (5.3.0-r0)
(12/21) Installing libatomic (5.3.0-r0)
(13/21) Installing pkgconf (0.9.12-r0)
(14/21) Installing pkgconfig (0.25-r1)
(15/21) Installing mpfr3 (3.1.2-r0)
(16/21) Installing mpc1 (1.0.3-r0)
(17/21) Installing gcc (5.3.0-r0)
(18/21) Installing musl-dev (1.1.14-r14)
(19/21) Installing libc-dev (0.7-r0)
(20/21) Installing g++ (5.3.0-r0)
(21/21) Upgrading musl-utils (1.1.14-r12 -> 1.1.14-r14)
Executing busybox-1.24.2-r11.trigger
OK: 230 MiB in 51 packages
/ # ln -s locale.h /usr/include/xlocale.h
/ # pip install numpy==1.11.3 pandas==0.20.2
Collecting numpy==1.11.3
  Downloading numpy-1.11.3.zip (4.7MB)
    100% |████████████████████████████████| 4.7MB 242kB/s 
Collecting pandas==0.20.2
  Downloading pandas-0.20.2.tar.gz (10.3MB)
    100% |████████████████████████████████| 10.3MB 124kB/s 
Collecting python-dateutil (from pandas==0.20.2)
  Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 994kB/s 
Collecting pytz>=2011k (from pandas==0.20.2)
  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
    100% |████████████████████████████████| 491kB 874kB/s 
Collecting six>=1.5 (from python-dateutil->pandas==0.20.2)
  Downloading six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: numpy, pandas
  Running setup.py bdist_wheel for numpy ... done
  Stored in directory: /root/.cache/pip/wheels/8f/d6/97/4cc26777ee05997164e480e2e5de2c9e9c4e32dfe325ea5bd6
  Running setup.py bdist_wheel for pandas ... done
  Stored in directory: /root/.cache/pip/wheels/fc/fd/0a/5857e8bee7d5cc3ca22228fb7ab5efa43be57c0f9103e54098
Successfully built numpy pandas
Installing collected packages: numpy, six, python-dateutil, pytz, pandas
Successfully installed numpy-1.11.3 pandas-0.20.2 python-dateutil-2.6.0 pytz-2017.2 six-1.10.0
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/ # python -c "import pandas"
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pandas/__init__.py", line 35, in <module>
    "the C extensions first.".format(module))
ImportError: C extension: umpy.core.multiarray failed to import 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.

Problem description

Installing Pandas with pip is successful, but import pandas breaks.

If I issue two separate pip install commands, one for numpy and one for pandas, it works:

> docker run --tty --interactive --rm python:2.7.12-alpine ash
/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
v3.4.6-150-gf952adf [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.6-83-g67e50bc [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
OK: 5983 distinct packages available
/ # apk add cython g++ musl-dev
(1/21) Upgrading musl (1.1.14-r12 -> 1.1.14-r14)
(2/21) Installing libffi (3.2.1-r2)
(3/21) Installing python (2.7.12-r0)
(4/21) Installing cython (0.24-r1)
(5/21) Installing libgcc (5.3.0-r0)
(6/21) Installing libstdc++ (5.3.0-r0)
(7/21) Installing binutils-libs (2.26-r1)
(8/21) Installing binutils (2.26-r1)
(9/21) Installing gmp (6.1.0-r0)
(10/21) Installing isl (0.14.1-r0)
(11/21) Installing libgomp (5.3.0-r0)
(12/21) Installing libatomic (5.3.0-r0)
(13/21) Installing pkgconf (0.9.12-r0)
(14/21) Installing pkgconfig (0.25-r1)
(15/21) Installing mpfr3 (3.1.2-r0)
(16/21) Installing mpc1 (1.0.3-r0)
(17/21) Installing gcc (5.3.0-r0)
(18/21) Installing musl-dev (1.1.14-r14)
(19/21) Installing libc-dev (0.7-r0)
(20/21) Installing g++ (5.3.0-r0)
(21/21) Upgrading musl-utils (1.1.14-r12 -> 1.1.14-r14)
Executing busybox-1.24.2-r11.trigger
OK: 230 MiB in 51 packages
/ # ln -s locale.h /usr/include/xlocale.h
/ # pip install numpy==1.11.3 
Collecting numpy==1.11.3
  Downloading numpy-1.11.3.zip (4.7MB)
    100% |████████████████████████████████| 4.7MB 221kB/s 
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy ... done
  Stored in directory: /root/.cache/pip/wheels/8f/d6/97/4cc26777ee05997164e480e2e5de2c9e9c4e32dfe325ea5bd6
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.11.3
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/ # pip install pandas==0.20.2
Collecting pandas==0.20.2
  Downloading pandas-0.20.2.tar.gz (10.3MB)
    100% |████████████████████████████████| 10.3MB 125kB/s 
Collecting python-dateutil (from pandas==0.20.2)
  Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 787kB/s 
Collecting pytz>=2011k (from pandas==0.20.2)
  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
    100% |████████████████████████████████| 491kB 1.0MB/s 
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /usr/local/lib/python2.7/site-packages (from pandas==0.20.2)
Collecting six>=1.5 (from python-dateutil->pandas==0.20.2)
  Downloading six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: pandas
  Running setup.py bdist_wheel for pandas ... done
  Stored in directory: /root/.cache/pip/wheels/fc/fd/0a/5857e8bee7d5cc3ca22228fb7ab5efa43be57c0f9103e54098
Successfully built pandas
Installing collected packages: six, python-dateutil, pytz, pandas
Successfully installed pandas-0.20.2 python-dateutil-2.6.0 pytz-2017.2 six-1.10.0
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/ # python -c "import pandas"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions