有没有办法安装Pandas和PyPy?

tktrz96b  于 2023-02-14  发布在  其他
关注(0)|答案(3)|浏览(189)

我尝试运行一些代码使用PyPy来加速它。我的代码使用Pandas Dataframe ,所以我尝试找到一种方法来安装软件包...
不幸的是,我找不到这样做的方法......在线搜索得到thisthis--这两个令人失望的结果表明这是不可能的,但它们已经存在了1-2年!
this twitter post from Romain Guillebert给我带来了一线希望,它建议我可以使用一个名为**pymetabiosis**的软件包来安装它。不幸的是,当我安装它时,我得到了下面提到的错误。

知道如何调试错误或找到其他方法将Pandas与PyPy一起使用吗?**

安装pymetabiosis时出现错误消息:

Collecting pymetabiosis
  Using cached pymetabiosis-0.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    pymetabiosis/__pycache__/_cffi__x771a6f66x197b9d2b.c:219:13: warning: initializing 'char **' with an expression of type 'const char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      { char * *tmp = &p->ml_name; (void)tmp; }
                ^     ~~~~~~~~~~~
    pymetabiosis/__pycache__/_cffi__x771a6f66x197b9d2b.c:220:13: warning: incompatible pointer types initializing 'void **' with an expression of type 'PyCFunction *' (aka 'struct _object *(**)(struct _object *, struct _object *)') [-Wincompatible-pointer-types]
      { void * *tmp = &p->ml_meth; (void)tmp; }
                ^     ~~~~~~~~~~~
    pymetabiosis/__pycache__/_cffi__x771a6f66x197b9d2b.c:222:13: warning: initializing 'char **' with an expression of type 'const char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      { char * *tmp = &p->ml_doc; (void)tmp; }
                ^     ~~~~~~~~~~
    pymetabiosis/__pycache__/_cffi__x771a6f66x197b9d2b.c:1189:30: warning: incompatible pointer types passing 'PyObject *' (aka 'struct _object *') to parameter of type 'PyCodeObject *' [-Wincompatible-pointer-types]
      { result = PyEval_EvalCode(x0, x1, x2); }
                                 ^~
    //anaconda/include/python2.7/eval.h:10:54: note: passing argument to parameter here
    PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
                                                         ^
    pymetabiosis/__pycache__/_cffi__x771a6f66x197b9d2b.c:1857:12: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
      { result = PyObject_SetAttr(x0, x1, x2); }
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    pymetabiosis/__pycache__/_cffi__x771a6f66x197b9d2b.c:2164:5: warning: incompatible pointer types assigning to 'PyObject *(*)(size_t, ...)' (aka 'struct _object *(*)(unsigned long, ...)') from 'PyObject *(Py_ssize_t, ...)' (aka 'struct _object *(long, ...)') [-Wincompatible-pointer-types]
      i = (PyTuple_Pack);
        ^ ~~~~~~~~~~~~~~
    6 warnings generated.
    ld: warning: directory not found for option '-L//anaconda/lib
    '
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/t4/n42mh55n05sd6s5hgk1dzdz80000gp/T/pip-build-fSTXPd/pymetabiosis/setup.py", line 2, in <module>
        from pymetabiosis.bindings import ffi
      File "pymetabiosis/__init__.py", line 1, in <module>
        from pymetabiosis.module import import_module
      File "pymetabiosis/module.py", line 2, in <module>
        from pymetabiosis.wrapper import MetabiosisWrapper
      File "pymetabiosis/wrapper.py", line 3, in <module>
        from __pypy__ import identity_dict
    ImportError: No module named __pypy__

    ----------------------------------------
Command "python setup.py egg_info" failed with error code -11 in /private/var/folders/t4/n42mh55n05sd6s5hgk1dzdz80000gp/T/pip-build-fSTXPd/pymetabiosis/
zzzyeukh

zzzyeukh1#

pypy v5.9已经开始支持Pandas(和numpy)

igetnqfo

igetnqfo2#

下面是我所做的,假设您使用的是Conda,但是Pip/Venv也应该可以工作
创建新的Conda环境

conda create --name pypy_env
conda activate pypy_env

使用conda安装pypy 3

conda install pypy3

使用此处的方法Install pip on pypy获取pypy 3的Pip
使用安装pypy包

pypy3 -m pip install pandas
uz75evzq

uz75evzq3#

在ubuntu/debian机器上安装和配置pypy3非常简单:

sudo add-apt-repository ppa:pypy/ppa
sudo apt update
sudo apt install pypy3

您还可以添加:

sudo apt install pypy3-dev pypy3-venv

然后可以全局安装pandasnumpy

pypy3 -m pip install pandas numpy

通过pip安装可能需要几分钟才能完成

相关问题