有什么依赖关系来运行pandas pd.test()?

问题描述 投票:0回答:1

通过pip安装pandas之后我尝试按pd.test()运行these instructions我收到的错误似乎表明缺少模块。安装了pytest和moto以解决前两个问题并且看起来像google-compute-engine将是它正在寻找的下一个模块。是否有一个必要的模块列表运行pd.test()

也许有更好的方法来解决这个问题。通常我只是安装一个anaconda环境,但这是服务器上现有的python环境。

谢谢。

编辑:添加错误

Python 3.6.4 (default, Jan 16 2018, 13:13:52)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pandas as pd

In [2]: pd.test()
running: pytest --skip-slow --skip-network /opt/bitnami/python/lib/python3.6/site-packages/pandas
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.6.4, pytest-3.4.1, py-1.5.2, pluggy-0.6.0
rootdir: /opt/bitnami, inifile:
collected 0 items / 1 errors

================================================================================================================== ERRORS ===================================================================================================================
_____________________________________________________________________________________________________________ ERROR collecting  _____________________________________________________________________________________________________________
../../../../python/lib/python3.6/site-packages/_pytest/config.py:329: in _getconftestmodules
    return self._path2confmods[path]
E   KeyError: local('/opt/bitnami/python/lib/python3.6/site-packages/pandas/tests/io')

During handling of the above exception, another exception occurred:
../../../../python/lib/python3.6/site-packages/_pytest/config.py:360: in _importconftest
    return self._conftestpath2mod[conftestpath]
E   KeyError: local('/opt/bitnami/python/lib/python3.6/site-packages/pandas/tests/io/conftest.py')

During handling of the above exception, another exception occurred:
../../../../python/lib/python3.6/site-packages/_pytest/config.py:366: in _importconftest
    mod = conftestpath.pyimport()
../../../../python/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport
    __import__(modname)
../../../../python/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:213: in load_module
    py.builtin.exec_(co, mod.__dict__)
../../../../python/lib/python3.6/site-packages/pandas/tests/io/conftest.py:3: in <module>
    import moto
../../../../python/lib/python3.6/site-packages/moto/__init__.py:8: in <module>
    from .acm import mock_acm  # flake8: noqa
../../../../python/lib/python3.6/site-packages/moto/acm/__init__.py:2: in <module>
    from .models import acm_backends
../../../../python/lib/python3.6/site-packages/moto/acm/models.py:7: in <module>
    from moto.ec2 import ec2_backends
../../../../python/lib/python3.6/site-packages/moto/ec2/__init__.py:2: in <module>
    from .models import ec2_backends
../../../../python/lib/python3.6/site-packages/moto/ec2/models.py:13: in <module>
    import boto.ec2
../../../../python/lib/python3.6/site-packages/boto/__init__.py:1216: in <module>
    boto.plugin.load_plugins(config)
../../../../python/lib/python3.6/site-packages/boto/plugin.py:93: in load_plugins
    _import_module(file)
../../../../python/lib/python3.6/site-packages/boto/plugin.py:75: in _import_module
    return imp.load_module(name, file, filename, data)
../../../../python/lib/python3.6/imp.py:235: in load_module
    return load_source(name, filename, file)
../../../../python/lib/python3.6/imp.py:172: in load_source
    module = _load(spec)
/usr/lib/python2.7/dist-packages/google_compute_engine/boto/compute_auth.py:19: in <module>
    from google_compute_engine import logger
E   ModuleNotFoundError: No module named 'google_compute_engine'

During handling of the above exception, another exception occurred:
../../../../python/lib/python3.6/site-packages/py/_path/common.py:377: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../../../../python/lib/python3.6/site-packages/py/_path/common.py:429: in gen
    for p in self.gen(subdir):
../../../../python/lib/python3.6/site-packages/py/_path/common.py:418: in gen
    dirs = self.optsort([p for p in entries
../../../../python/lib/python3.6/site-packages/py/_path/common.py:419: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
../../../../python/lib/python3.6/site-packages/_pytest/main.py:411: in _recurse
    ihook = self.gethookproxy(path)
../../../../python/lib/python3.6/site-packages/_pytest/main.py:315: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
../../../../python/lib/python3.6/site-packages/_pytest/config.py:343: in _getconftestmodules
    mod = self._importconftest(conftestpath)
../../../../python/lib/python3.6/site-packages/_pytest/config.py:368: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   _pytest.config.ConftestImportFailure: ModuleNotFoundError("No module named 'google_compute_engine'",)
E     File "/opt/bitnami/python/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 213, in load_module
E       py.builtin.exec_(co, mod.__dict__)
E     File "/opt/bitnami/python/lib/python3.6/site-packages/pandas/tests/io/conftest.py", line 3, in <module>
E       import moto
E     File "/opt/bitnami/python/lib/python3.6/site-packages/moto/__init__.py", line 8, in <module>
E       from .acm import mock_acm  # flake8: noqa
E     File "/opt/bitnami/python/lib/python3.6/site-packages/moto/acm/__init__.py", line 2, in <module>
E       from .models import acm_backends
E     File "/opt/bitnami/python/lib/python3.6/site-packages/moto/acm/models.py", line 7, in <module>
E       from moto.ec2 import ec2_backends
E     File "/opt/bitnami/python/lib/python3.6/site-packages/moto/ec2/__init__.py", line 2, in <module>
E       from .models import ec2_backends
E     File "/opt/bitnami/python/lib/python3.6/site-packages/moto/ec2/models.py", line 13, in <module>
E       import boto.ec2
E     File "/opt/bitnami/python/lib/python3.6/site-packages/boto/__init__.py", line 1216, in <module>
E       boto.plugin.load_plugins(config)
E     File "/opt/bitnami/python/lib/python3.6/site-packages/boto/plugin.py", line 93, in load_plugins
E       _import_module(file)
E     File "/opt/bitnami/python/lib/python3.6/site-packages/boto/plugin.py", line 75, in _import_module
E       return imp.load_module(name, file, filename, data)
E     File "/opt/bitnami/python/lib/python3.6/imp.py", line 235, in load_module
E       return load_source(name, filename, file)
E     File "/opt/bitnami/python/lib/python3.6/imp.py", line 172, in load_source
E       module = _load(spec)
E     File "/usr/lib/python2.7/dist-packages/google_compute_engine/boto/compute_auth.py", line 19, in <module>
E       from google_compute_engine import logger
============================================================================================================= warnings summary ==============================================================================================================
None
  could not create cache path /opt/bitnami/.pytest_cache/v/cache/lastfailed

-- Docs: http://doc.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================================== 1 warnings, 1 error in 2.42 seconds ====================================================================================================
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

目前安装的包:

Package                  Version
------------------------ ----------------------
asn1crypto               0.24.0
attrs                    17.4.0
aws-xray-sdk             0.96
boto                     2.48.0
boto3                    1.4.7
botocore                 1.7.43
Bottleneck               1.2.1
cachetools               2.0.1
certifi                  2018.1.18
cffi                     1.11.5
chardet                  3.0.4
cookies                  2.2.1
cryptography             2.1.4
decorator                4.2.1
Django                   2.0.2
djangorestframework      3.7.7
docker                   3.1.0
docker-pycreds           0.2.2
docutils                 0.12
elementtree              1.2.7-20070827-preview
firebase-admin           2.9.0
future                   0.16.0
gevent                   1.2.2
google-api-core          1.0.0
google-auth              1.4.1
google-cloud-core        0.28.1
google-cloud-firestore   0.29.0
google-cloud-storage     1.8.0
google-resumable-media   0.3.1
googleapis-common-protos 1.5.3
greenlet                 0.4.10
html5lib                 0.90
idna                     2.6
ipython                  6.2.1
ipython-genutils         0.2.0
jedi                     0.11.1
Jinja2                   2.10
jmespath                 0.9.3
jsondiff                 1.1.1
jsonpickle               0.9.6
lxml                     3.5.0
Markdown                 2.6.9
MarkupSafe               0.23
mock                     2.0.0
moto                     1.2.0
mysqlclient              1.3.12
numexpr                  2.6.4
numpy                    1.14.1
pandas                   0.22.0
parso                    0.1.1
pbr                      1.9.1
pexpect                  4.4.0
pickleshare              0.7.4
Pillow                   3.4.1
pip                      9.0.1
pluggy                   0.6.0
prompt-toolkit           1.0.15
protobuf                 3.5.1
psutil                   4.3.1
psycopg2                 2.7.1
ptyprocess               0.5.2
py                       1.5.2
pyaml                    17.12.1
pyasn1                   0.4.2
pyasn1-modules           0.2.1
pycairo                  1.15.3
pycparser                2.18
pycrypto                 2.6.1
pydot                    1.2.3
Pygments                 2.2.0
pyldap                   2.4.37
pyparsing                2.1.10
pytest                   3.4.1
python-dateutil          2.6.1
python-http-client       3.0.0
python-Levenshtein       0.12.0
python-openid            2.2.5
pytz                     2016.7
PyYAML                   3.12
reportlab                3.3.0
requests                 2.18.4
rsa                      3.4.2
s3transfer               0.1.11
scandir                  1.5
sendgrid                 5.3.0
setuptools               38.5.1
simplegeneric            0.8.1
simplejson               3.11.1
six                      1.10.0
stevedore                1.1.0
traitlets                4.3.2
urllib3                  1.22
virtualenv               15.1.0
virtualenv-clone         0.2.6
virtualenvwrapper        4.8.2
wcwidth                  0.1.7
websocket-client         0.47.0
Werkzeug                 0.14.1
wrapt                    1.10.11
XlsxWriter               1.0.2
xmltodict                0.11.0
python pandas pip
1个回答
2
投票

根据Pandas Documentation,以下是该模块的依赖关系。

setuptools, NumPy, python-dateutil, pytz

我遇到了同样的问题,我只是通过PyCharm IDE安装pandas来修复它。我不确定它有什么不同之处;但是,它奏效了。

© www.soinside.com 2019 - 2024. All rights reserved.