> 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.
使用pip
安装 Pandas 成功,但import pandas
中断。
如果我发出两个单独的pip install
命令,一个用于numpy
,另一个用于pandas
,它会起作用:
> 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"
看起来很像https://github.com/pandas-dev/pandas/issues/11383#issuecomment -294242777
您可以尝试使用详细模式来查看同时执行它们时 pip 抓取的 numpy 版本吗?
看起来它正在接收numpy
1.13.0
:
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/tmp/pip-build-WbJa3a/pandas/.eggs/numpy-1.13.0-py2.7-linux-x86_64.egg/numpy/core/include -I/usr/local/include/python2.7 -c pandas/_libs/testing.c -o build/temp.linux-x86_64-2.7/pandas/_libs/testing.o -Wno-unused-function
gcc -shared build/temp.linux-x86_64-2.7/pandas/_libs/testing.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/pandas/_libs/testing.so
building 'pandas._libs.lib' extension
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/tmp/pip-build-WbJa3a/pandas/.eggs/numpy-1.13.0-py2.7-linux-x86_64.egg/numpy/core/include -I/usr/local/include/python2.7 -c pandas/_libs/lib.c -o build/temp.linux-x86_64-2.7/pandas/_libs/lib.o -Wno-unused-function
In file included from /tmp/pip-build-WbJa3a/pandas/.eggs/numpy-1.13.0-py2.7-linux-x86_64.egg/numpy/core/include/numpy/ndarraytypes.h:1809:0,
from /tmp/pip-build-WbJa3a/pandas/.eggs/numpy-1.13.0-py2.7-linux-x86_64.egg/numpy/core/include/numpy/ndarrayobject.h:18,
from /tmp/pip-build-WbJa3a/pandas/.eggs/numpy-1.13.0-py2.7-linux-x86_64.egg/numpy/core/include/numpy/arrayobject.h:4,
from pandas/_libs/lib.c:435:
/tmp/pip-build-WbJa3a/pandas/.eggs/numpy-1.13.0-py2.7-linux-x86_64.egg/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
也许然后尝试报告 pip 问题跟踪器。 我们的 setup.py 可能有问题,但错误 pip 或 setuptools 似乎更有可能。
@rvernica从源代码构建熊猫,而不是下载和安装轮子,是否有特定原因? 因为有了轮子,我认为它应该安装没有问题。
啊,我没有看到 pip 版本那么旧。 到时候可能已经修好了。
@jorisvandenbossche我只是在做pip install
, pip
选择从源代码构建它可能是因为没有轮子。
我先尝试升级pip
:
/ # pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 480kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Successfully installed pip-9.0.1
但结果是一样的, pip
成功但import pandas
失败。
pandas-0.20.2当然应该有一个轮子,所以不知道为什么不下载它..
然而,它是什么系统? 它可能与manylinux
要求不兼容。
但这确实与https://github.com/pandas-dev/pandas/issues/11383 中的问题相同pip
安装会中断。 原因是 pip 似乎在一个单独的 env 中构建了熊猫,它使用最新的 numpy,但在实际的 env 中安装了旧版本的 numpy,因此会出现错误。 解决方案是分两步完成(然后 numpy 已经安装,并且在构建 Pandas 时它将使用它而不是获取另一个)。
因此,对于这个用例,要么 pip 坏了,要么我们在 setup.py 中做错了(但不是这方面的专家)
说得通。 系统为Alpine Linux 3.4。
@rvernica您是否在 pip 问题跟踪器上报告过这个问题? 我以为我可以用--no-binary
选项重现这个,但这拉低了正确的 numpy 版本。
不,我没有机会举报。
我以为我可以使用 --no-binary 选项重现它,但这会降低正确的 numpy 版本。
@TomAugspurger您是否指定了旧版本的 numpy? (因为需要触发它,例如pip install numpy==1.11 pandas==0.20
)
是的,我在一个干净的环境中做了pip install numpy==1.11.3 pandas==0.20.2 --no-binary=':all:' --verbose
。
好的,我不会在上游报告这个,因为https://github.com/pypa/pip/issues/3691 (在 https://github.com/pypa/pip/pull/4144 中实现)是正确的解决方案。 让我们试一试。
对于构建步骤,版本信息可能仍会被忽略,在这种情况下,我们应该将其报告给 pip。 我会做一个 PR 添加pyproject.toml
我不确定 PEP518 是否会对此进行任何更改,因为问题仍然存在,即在您构建 Pandas 轮时(pyproject.toml 中的 numpy>0.17 规范,它将下载最新的 1.13)它不会似乎知道同时安装的确切 numpy 版本(因此可能比造轮步骤中使用的版本旧)
我们真的应该将 numpy 版本固定到构建系统需要的最旧的支持版本吗? (我们在构建轮子分发时在实践中做了什么?)由于这是在孤立的环境中完成的,它不应该影响您的实际环境
还是有问题,有什么解决办法吗?
你读过上面的评论吗? 尝试分两个单独的步骤安装 numpy 和 pandas。 否则,您将需要提供有关您遇到的特定问题的更多详细信息。
你好,
我也手动安装了(注意:只有已经相同的版本),使用“pip install numpy==1.12.0 pandas==0.21.0”
虽然之后,在执行 python -c "import pandas" 时出现错误
“首先是 C 扩展。”.format(module))
导入错误:C 扩展名:numpy.core.multiarray 未能导入未构建。 如果您想从源目录导入熊猫,您可能需要先运行“python setup.py build_ext --inplace --force”来构建 C 扩展。
正如我上面所说,请阅读上面的评论,如果是同样的问题,你需要单独安装它们,所以pip install numpy=1.12.0
然后pip install pandas=0.21.0
@jorisvandenbossche我已经单独安装了,还是同样的错误。 我做了其他方式。 我在单独的目录中克隆了熊猫并安装了熊猫,我可以在其中导入熊猫,但是当我从外部目录执行相同操作时,它一直在寻找要运行的源目录路径
须藤 pip 安装 numpy==1.12.0
需求已经满足:numpy==1.12.0 in /usr/local/lib/python2.7/dist-packages
ubuntu @ocata :~/
要求已经满足:pandas==0.21.0 in /usr/local/lib/python2.7/dist-packages
已经满足要求:pytz>=2011k in /usr/local/lib/python2.7/dist-packages(来自pandas==0.21.0)
已经满足要求:numpy>=1.9.0 in /usr/local/lib/python2.7/dist-packages(来自pandas==0.21.0)
要求已经满足:/usr/local/lib/python2.7/dist-packages中的python-dateutil(来自pandas==0.21.0)
要求已经满足:6>=1.5 in /usr/local/lib/python2.7/dist-packages(来自python-dateutil->pandas==0.21.0)
ubuntu@ocata :~/
运行时错误:针对 API 版本 0xb 编译的模块,但此版本的 numpy 是 0xa
回溯(最近一次调用最后一次):
文件 ”",第 1 行,在
文件“/usr/local/lib/python2.7/dist-packages/pandas/__init__.py”,第35行,在
“首先是 C 扩展。”.format(module))
导入错误:C 扩展名:numpy.core.multiarray 未能导入未构建。 如果您想从源目录导入熊猫,您可能需要先运行“python setup.py build_ext --inplace --force”来构建 C 扩展。
您需要提供更详细的信息。 例如,您执行的不同步骤的完整控制台输出,理想情况下带有一些详细选项,有关环境的一些信息(哪个操作系统,python 版本,...),为什么要从源代码安装而不是从轮子安装,...
蟒蛇 2.7.12
操作系统:ubuntu 16.04 xenial
我需要按照http://gnocchi.xyz/install.html#installation -using-devstack 安装 gnocchi,在添加插件后,运行 ./stack.sh,其中 gnocchi 安装https://github.com/gnocchixyz/ gnocchi有 Pandas 依赖项,当它尝试安装/导入 Pandas 时出现错误
这里是pandas的gnocchi文件依赖https://github.com/gnocchixyz/gnocchi/blob/ffbb446f3f12d637a6ff45b3eb522191638e8be0/tools/duration_perf_analysis.py#L37
换一种方式,假设我需要安装熊猫,我必须在单独的目录中克隆并使用它们的模块,如果我安装在一个目录中并尝试从外部目录导入,它不会被识别,我可以导入所有在 /python/dist-packages/ 下与源目录无关的模块
须藤 pip 安装熊猫
需求已经满足:/usr/local/lib/python2.7/dist-packages中的pandas
已经满足要求:pytz>=2011k in /usr/local/lib/python2.7/dist-packages(来自pandas)
要求已经满足:numpy>=1.9.0 in /usr/local/lib/python2.7/dist-packages(来自熊猫)
要求已经满足:/usr/local/lib/python2.7/dist-packages中的python-dateutil(来自pandas)
要求已经满足:6>=1.5 in /usr/local/lib/python2.7/dist-packages(来自python-dateutil->pandas)
ubuntu@ocata :/usr/local/lib/python2.7/dist-packages$ python -c "import pandas"
运行时错误:针对 API 版本 0xb 编译的模块,但此版本的 numpy 是 0xa
回溯(最近一次调用最后一次):
文件 ”
文件“pandas/__init__.py”,第 35 行,在
“首先是 C 扩展。”.format(module))
导入错误:C 扩展名:numpy.core.multiarray 未能导入未构建。 如果您想从源目录导入熊猫,您可能需要先运行“python setup.py build_ext --inplace --force”来构建 C 扩展。
@jorisvandenbossche让我知道所需的详细信息(如果有)
最后一个日志输出显示“需求已经满足:pandas”,因此您实际上并未安装它。
此外,请确保 pip 引用相同的 python(例如执行python -m pip
),以及为什么要从 dist-packages 导入 Pandas?
@jorisvandenbossche的“要求已经满足:pandas” - 因为我已经按照你说的单独安装了,当我再次尝试时,它肯定会显示这样。
你为什么要从 dist-packages 导入熊猫? -->> 我到处都试过了,它没有运行。
让我知道如何在 ubuntu 16.04 中安装 Pandas,其中 python 是 2.7。
到目前为止,我已经安装了新机器
pip install numpy==1.12.0 然后pip install pandas==0.21.0,
安装后,同样的错误
pip install numpy==1.12.0 然后pip install pandas==0.21.0,安装后,得到同样的错误
然后显示该日志的完整日志(而不是实际未安装任何内容的日志,您需要在尚未安装 numpy 和 pandas 的新环境中执行此操作)
@jorisvandenbossche在新机器安装中
须藤 pip 安装熊猫
收集大熊猫
使用缓存的 pandas-0.21.0-cp27-cp27mu-manylinux1_x86_64.whl
已经满足要求:pytz>=2011k in /usr/local/lib/python2.7/dist-packages(来自pandas)
要求已经满足:numpy>=1.9.0 in /usr/lib/python2.7/dist-packages (from pandas)
要求已经满足:/usr/local/lib/python2.7/dist-packages中的python-dateutil(来自pandas)
要求已经满足:6>=1.5 in /usr/local/lib/python2.7/dist-packages(来自python-dateutil->pandas)
安装收集的包:pandas
成功安装pandas-0.21.0
ubuntu@ocata :~$ sudo pip install numpy
要求已经满足:/usr/lib/python2.7/dist-packages中的numpy
ubuntu@ocata :~$ python -c "导入熊猫"
运行时错误:针对 API 版本 0xb 编译的模块,但此版本的 numpy 是 0xa
回溯(最近一次调用最后一次):
文件 ”
文件“/usr/local/lib/python2.7/dist-packages/pandas/__init__.py”,第35行,在
“首先是 C 扩展。”.format(module))
导入错误:C 扩展名:numpy.core.multiarray 未能导入未构建。 如果您想从源目录导入熊猫,您可能需要先运行“python setup.py build_ext --inplace --force”来构建 C 扩展。
您应该在 Pandas 之前安装 numpy(尽管在这种情况下它无关紧要,因为 numpy 没有安装自己,因为它已经安装了)。 您可以显示相同的但新安装 numpy 和 pandas(首先安装 numpy)吗?
顺便说一句,导入 numpy 是否有效?
@jorisvandenbossche 首先安装了 numpy,它可以正常导入,安装了 Pandas 并且导入很好,但是在按照 gnocchi 执行 ./stack.sh 时,pandas 导入是错误的,而 import numpy 很好
您的sudo python
可能与您的python
。 使用python -m pip install ...
,并且仅在必要时使用sudo
。
@TomAugspurger我没有将两者结合起来,我已经使用 pip install 安装了熊猫,安装没有问题,
这是我的问题; numpy=1.12.0 是否兼容pandas=0.21.0
或者什么是兼容的?
我尝试过 numpy latest 和 pandas latest 之一。 还是不行,是不是有兼容性问题? 还是最兼容的 numpy 和 pandas 版本?
@maestropandy看看你的路径:
sudo pip install pandas
Collecting pandas
Using cached pandas-0.21.0-cp27-cp27mu-manylinux1_x86_64.whl
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas)
ubuntu<strong i="9">@ocata</strong>:~$ sudo pip install numpy
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages
第一个是/usr/local/lib
,第二个是/usr/lib
,所以有些东西不在那里。 您的异常来自usr/local/lib
的 python。
@TomAugspurger "sudo python -m pip install numpy" 会安装在 /usr/local/lib/ 中吗? 会尝试。
另外让我知道 numpy & pandas 是否存在任何兼容性问题,因为我已经安装了 numpy>=1.9.0 & pandas>=0.18.0 这意味着 numpy 和 pandas 的最新版本,但似乎兼容?
另外让我知道 numpy 和 pandas 是否存在任何兼容性问题,
您通常提到的这些版本之间没有不兼容性。 问题是您如何安装两者。
新的熊猫版本有问题..所以直到问题得到解决,使用pip install pandas==0.20.2
@abhishekg2389你能提供更多信息吗? 如果我们的构建文件有问题,我们想知道。
我在 Fedora 25 下看到了类似(相同?)的问题。
$ python --version
Python 2.7.13
$ which python
/usr/bin/python
md5-c7b975f7c1ac4eb89f5fe68ce1d09cd7
$ sudo pip install pandas
[sudo] password for .....:
Requirement already satisfied: pandas in /usr/lib64/python2.7/site-packages
Requirement already satisfied: pytz>=2011k in /usr/lib/python2.7/site-packages (from pandas)
Requirement already satisfied: python-dateutil in /usr/lib/python2.7/site-packages (from pandas)
Requirement already satisfied: numpy>=1.9.0 in /usr/lib64/python2.7/site-packages (from pandas)
Requirement already satisfied: six>=1.5 in /usr/lib/python2.7/site-packages (from python-dateutil->pandas)
$ sudo pip install numpy
Requirement already satisfied: numpy in /usr/lib64/python2.7/site-packages
md5-79f115fb1bb7ca0fecb38162c5f341da
$ python testPandas.py
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
File "runProphet.py", line 1, in <module>
import pandas as pd
File "/usr/lib64/python2.7/site-packages/pandas/__init__.py", line 35, in <module>
"the C extensions first.".format(module))
ImportError: C extension: numpy.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.
md5-fca2a04366ebb14ff185882c94092f99
$ sudo pip install pandas==0.20.2
[sudo] password for jbooker:
Collecting pandas==0.20.2
Downloading pandas-0.20.2-cp27-cp27mu-manylinux1_x86_64.whl (22.4MB)
100% |████████████████████████████████| 22.4MB 79kB/s
Requirement already satisfied: pytz>=2011k in /usr/lib/python2.7/site-packages (from pandas==0.20.2)
Requirement already satisfied: numpy>=1.7.0 in /usr/lib64/python2.7/site-packages (from pandas==0.20.2)
Requirement already satisfied: python-dateutil in /usr/lib/python2.7/site-packages (from pandas==0.20.2)
Requirement already satisfied: six>=1.5 in /usr/lib/python2.7/site-packages (from python-dateutil->pandas==0.20.2)
Installing collected packages: pandas
Found existing installation: pandas 0.21.0
Uninstalling pandas-0.21.0:
Successfully uninstalled pandas-0.21.0
Successfully installed pandas-0.20.2
安装了什么版本的numpy? 你能显示安装pandas 0.21.0的输出吗? (你展示的那个实际上并没有安装,因为它当时已经安装了)
$ pip show numpy
Name: numpy
Version: 1.11.2
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: NumPy Developers
Author-email: [email protected]
License: BSD
Location: /usr/lib64/python2.7/site-packages
我似乎没有安装熊猫 0.21.0 的输出。 它似乎已经安装在我的系统上(??)。 我没有看到 RPM 包,所以它不是通过 yum/dnf 系统包安装的。
我试图安装 Facebook 的 Prophet 包(依赖于 Pandas 和 Numpy),它指出已经安装了 Pandas 0.18.1。 有趣的是它是 0.18.1 而不是 0.21.0。
$ sudo pip install fbprophet
Collecting fbprophet
Using cached fbprophet-0.2.1.tar.gz
Requirement already satisfied: matplotlib in /usr/lib64/python2.7/site-packages (from fbprophet)
Requirement already satisfied: pandas>=0.18.1 in /usr/lib64/python2.7/site-packages (from fbprophet)
Requirement already satisfied: pystan>=2.14 in /usr/lib64/python2.7/site-packages (from fbprophet)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: subprocess32 in /usr/lib64/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pytz in /usr/lib/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: six>=1.10 in /usr/lib/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: backports.functools-lru-cache in /usr/lib/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: numpy>=1.7.1 in /usr/lib64/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: python-dateutil>=2.0 in /usr/lib/python2.7/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in /usr/lib64/python2.7/site-packages (from pystan>=2.14->fbprophet)
Installing collected packages: fbprophet
Running setup.py install for fbprophet ... done
Successfully installed fbprophet-0.2.1
不知道如何安装 pandas 很难提供帮助。 您是否想再次将 pandas 升级到 0.21.0 以查看是否有效并记录输出?
有趣的是它是 0.18.1 而不是 0.21.0。
它只说 >=0.18.1,所以它可以是 0.21.0
啊对了。 我错过了 '>='.. 只是因为它满足要求,而不是特定版本。
再次尝试升级到 0.21.0,这在导入时重新创建了错误(但安装工作正常):
$ sudo pip install pandas==0.21.0
[sudo] password for jbooker:
Collecting pandas==0.21.0
Using cached pandas-0.21.0-cp27-cp27mu-manylinux1_x86_64.whl
Requirement already satisfied: pytz>=2011k in /usr/lib/python2.7/site-packages (from pandas==0.21.0)
Requirement already satisfied: python-dateutil in /usr/lib/python2.7/site-packages (from pandas==0.21.0)
Requirement already satisfied: numpy>=1.9.0 in /usr/lib64/python2.7/site-packages (from pandas==0.21.0)
Requirement already satisfied: six>=1.5 in /usr/lib/python2.7/site-packages (from python-dateutil->pandas==0.21.0)
Installing collected packages: pandas
Found existing installation: pandas 0.20.2
Uninstalling pandas-0.20.2:
Successfully uninstalled pandas-0.20.2
Successfully installed pandas-0.21.0
测试脚本:
import pandas as pd
import numpy as np
print "Hello, world."
再次输出错误:
$ python testPandas.py
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
File "runProphet.py", line 1, in <module>
import pandas as pd
File "/usr/lib64/python2.7/site-packages/pandas/__init__.py", line 35, in <module>
"the C extensions first.".format(module))
ImportError: C extension: numpy.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.
降级到 0.20.2 工作正常,这样做后测试脚本成功运行。
我还能做些什么来帮助缩小范围?
好的,我实际上可以重现这一点。 感谢报告!
重新打开这个问题,但作为一个新问题(因为这里的原始问题是其他问题,从源代码构建)
@jlbooker在这里开了一个问题来跟踪这个: https :
希望我们能快速解决这个问题
对我来说,这个问题是通过自行卸载和重新安装熊猫来解决的
最有用的评论
@jlbooker在这里开了一个问题来跟踪这个: https :
希望我们能快速解决这个问题