Home  >  Q&A  >  body text

python在做travis ci的时候的问题

Hi all.在build python ci的时候出错,提示无法找到模块, 下面是job log. 我的requirements.txt 为:


argparse
coloredlogs
importlib
unittest

Worker information
hostname: travis-worker-gce-org-prod4-8:c6b27b1f-8fa2-4741-9006-bcbad1a529a0
version: v2.3.1-34-g4ab376b https://github.com/travis-ci/worker/tree/xxx
instance: testing-gce-ebf94c1c-3cfe-45c2-a652-3dcf9d85561e:travis-ci-python-precise-1471814219
startup: 21.421705561s
system_info
Build system information
Build language: python
Build group: stable
Build dist: precise
Build id: 166945997
Job id: 166945998
travis-build version: c31595e05
Build image provisioning date and time
Sun Aug 21 21:35:17 UTC 2016
Operating System Details
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:    precise
Linux Version
3.13.0-92-generic
Cookbooks Version
f77e708 https://github.com/travis-ci/travis-cookbooks/tree/xx
Git version
git version 1.8.5.6
bash version
GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-2.2.5
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.2
mysql --version
mysql  Ver 14.14 Distrib 5.5.50, for debian-linux-gnu (x86_64) using readline 6.2
Pre-installed PostgreSQL versions
9.1.23
9.2.18
9.3.14
9.4.9
Redis version
redis-server 3.0.6
riak version
2.0.2
memcached version
1.4.13
MongoDB version
MongoDB 2.4.14
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
Cassandra version
2.0.9
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 38.4.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-92-generic", arch: "amd64", family: "unix"
fix.CVE-2015-7547
$ export DEBIAN_FRONTEND=noninteractive
Reading package lists...
Building dependency tree...
Reading state information...
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 69 not upgraded.
git.checkout
0.74s$ git clone --depth=50 --branch=master https://github.com/xxxx/xxxx.git xxxx/xxxx
Cloning into 'xxxx/xxxx'...
remote: Counting objects: 203, done.
remote: Compressing objects: 100% (62/62), done.
Receiving objects:  52% (106remote: Total 203 (delta 34), reused 0 (delta 0), pack-reused 140
Receiving objects: 100% (203/203), 39.62 KiB | 0 bytes/s, done.
Resolving deltas: 100% (113/113), done.
Checking connectivity... done.
$ cd xxxx/xxxx
$ git checkout -qf 1d9404346d2b8508c3aecb1a51a25c3b6fe8c243
NaNs$ source ~/virtualenv/python3.5/bin/activate
$ python --version
Python 3.5.2
$ pip --version
pip 8.1.2 from /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (python 3.5)
install.1
0.97s$ pip3 install .
Processing /home/travis/build/xxxx/xxxx
Installing collected packages: passme
  Running setup.py install for passme ... done
Successfully installed passme-1.0.0
0.66s$ pip3 install -r requirements.txt
Collecting argparse (from -r requirements.txt (line 1))
  Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting coloredlogs (from -r requirements.txt (line 2))
  Downloading coloredlogs-5.1.1-py2.py3-none-any.whl
Collecting importlib (from -r requirements.txt (line 3))
  Downloading importlib-1.0.4.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/setuptools/__init__.py", line 4, in <module>
        import distutils.core
      File "/home/travis/virtualenv/python3.5.2/lib/python3.5/distutils/__init__.py", line 4, in <module>
        import imp
      File "/home/travis/virtualenv/python3.5.2/lib/python3.5/imp.py", line 19, in <module>
        from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
    ImportError: No module named 'importlib._bootstrap'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-o6ity2w_/importlib/
The command "pip3 install -r requirements.txt" failed and exited with 1 during .
Your build has been stopped.
PHPzPHPz2647 days ago615

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:58:05

    importlib 1.0.4

    Backport of importlib.import_module() from Python 2.7

    Purpose

    This package contains the code from importlib as found in Python 2.7.
    It is provided so that people who wish to use
    importlib.import_module() with a version of Python prior to 2.7 or in
    3.0 have the function readily available. The code in no way deviates from what can be found in the Python 2.7 standard library.

    我不确定你是否真的知道你require的importlib是什么,它只适用于2.7以下和3.0的python版本。你进行ci的环境是3.5,已经自带了importlib这个包,不需要另外require。

    从requirements中移除这个模块,或者指定你需要的python版本进行测试。

    reply
    0
  • Cancelreply