Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Cython“;ModuleNotFoundError“;尽管它是在构建docker映像时通过requirements.txt安装的_Python_Docker_Gitlab_Requirements.txt - Fatal编程技术网

Python Cython“;ModuleNotFoundError“;尽管它是在构建docker映像时通过requirements.txt安装的

Python Cython“;ModuleNotFoundError“;尽管它是在构建docker映像时通过requirements.txt安装的,python,docker,gitlab,requirements.txt,Python,Docker,Gitlab,Requirements.txt,通过requirements.txt构建docker映像时安装软件包。在Dockerfile中,它显示 COPY requirements.txt /app/requirements.txt RUN pip3 install -r /app/requirements.txt 在requirements.txt中,我放置了用于安装私有git repo的部署令牌,例如下面的示例: git+https://gitlab+deploy-token-123456:a1b2c3d4e5f6g7h8j9@g

通过requirements.txt构建docker映像时安装软件包。在Dockerfile中,它显示

COPY requirements.txt /app/requirements.txt
RUN pip3 install -r /app/requirements.txt
在requirements.txt中,我放置了用于安装私有git repo的部署令牌,例如下面的示例:

git+https://gitlab+deploy-token-123456:a1b2c3d4e5f6g7h8j9@gitlab.com/example/lib.git@a1b2c3d4e5f6g7h8j9k1l2m3n4o5p6q7r8s9t
它抛出一个错误,
ModuleNotFoundError:没有名为“Cython”的模块。

然而,即使我在需求中包括Cython,并且它被正确地收集,我也会得到相同的错误

以下是完整的信息:

docker build -t docker.example/example:dev .
Sending build context to Docker daemon  8.704kB
Step 1/7 : FROM python:3.6.6-alpine
 ---> a78e257617d1
Step 2/7 : RUN apk update
 ---> Using cache
 ---> 35e6b7308e61
Step 3/7 : RUN apk add gcc build-base musl-dev libc-dev util-linux-dev linux-headers python3-dev git ca-certificates libffi-dev bash postgresql-libs postgresql-dev
 ---> Using cache
 ---> 5ca54839bb7c
Step 4/7 : RUN python3 -m ensurepip
 ---> Using cache
 ---> 03d95f700108
Step 5/7 : RUN pip install --upgrade pip
 ---> Using cache
 ---> e462d855f07f
Step 6/7 : COPY requirements.txt /app/requirements.txt
 ---> f69aa355732a
Step 7/7 : RUN pip3 install -r /app/requirements.txt
 ---> Running in d75911af46c7
Collecting git+https://gitlab%2Bdeploy-token-171703:****@gitlab.com/example/lib.git@f75285be6ee56360d6f0cfbf64f09a86819def5c (from -r /app/requirements.txt (line 2))
  Cloning https://gitlab%2Bdeploy-token-171703:****@gitlab.com/example/lib.git (to revision f75285be6ee56360d6f0cfbf64f09a86819def5c) to /tmp/pip-req-build-yt5mk7q5
  Running command git clone -q 'https://gitlab%2Bdeploy-token-171703:****@gitlab.com/example/lib.git' /tmp/pip-req-build-yt5mk7q5
Collecting Cython==0.29.17
  Downloading Cython-0.29.17-py2.py3-none-any.whl (971 kB)
Collecting psychrolib==2.5.0
  Downloading PsychroLib-2.5.0.zip (9.5 kB)
Collecting influxdb==5.2.2
  Downloading influxdb-5.2.2-py2.py3-none-any.whl (70 kB)
Collecting configparser==3.5.0
  Downloading configparser-3.5.0.tar.gz (39 kB)
Collecting reportlab
  Downloading reportlab-3.5.42.tar.gz (2.9 MB)
Collecting PyPDF2
  Downloading PyPDF2-1.26.0.tar.gz (77 kB)
Collecting matplotlib>=2.2.2
  Downloading matplotlib-3.2.1.tar.gz (40.3 MB)


    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mqz7vwwc/matplotlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mqz7vwwc/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-mqz7vwwc/matplotlib/pip-egg-info
         cwd: /tmp/pip-install-mqz7vwwc/matplotlib/
    Complete output (112 lines):
    Processing numpy/random/_bounded_integers.pxd.in
    Processing numpy/random/_bounded_integers.pyx.in
    Traceback (most recent call last):
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 61, in process_pyx
        from Cython.Compiler.Version import version as cython_version
    ModuleNotFoundError: No module named 'Cython'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 238, in <module>
        main()
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 234, in main
        find_process_files(root_dir)
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 225, in find_process_files
        process(root_dir, fromfile, tofile, function, hash_db)
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 191, in process
        processor_function(fromfile, tofile)
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 94, in process_tempita_pyx
        process_pyx(pyxfile, tofile)
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 66, in process_pyx
        raise OSError('Cython needs to be installed in Python as a module')
    OSError: Cython needs to be installed in Python as a module
    Running from numpy source directory.
    /tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 488, in <module>
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 469, in setup_package
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 275, in generate_cython
        )
    RuntimeError: Running cythonize failed!

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-mqz7vwwc/matplotlib/setup.py", line 274, in <module>
        cmdclass=cmdclass,
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 134, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 777, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1060, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1072, in obtain
        return installer(requirement)
      File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 581, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 676, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 702, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 887, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1155, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1141, in run_setup
        run_setup(setup_script, args)
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 488, in <module>
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 469, in setup_package
      File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 275, in generate_cython
        )
    RuntimeError: Running cythonize failed!

    Edit setup.cfg to change the build options; suppress output with --quiet.

    BUILDING MATPLOTLIB
      matplotlib: yes [3.2.1]
          python: yes [3.6.6 (default, Sep 12 2018, 02:15:29)  [GCC 6.4.0]]
        platform: yes [linux]
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]
             agg: yes [installing]
           tkagg: yes [installing; run-time loading from Python Tcl/Tk]
          macosx: no  [Mac OS-X only]

    Cythonizing sources
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip3 install -r /app/requirements.txt' returned a non-zero code: 1
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 1
docker构建-t docker.example/example:dev。
将生成上下文发送到Docker守护进程8.704kB
步骤1/7:来自python:3.6.6-1
--->a78e257617d1
步骤2/7:运行apk更新
--->使用缓存
--->35e6b7308e61
步骤3/7:运行apk add gcc build base musl dev libc dev util linux dev linux headers python3 dev git ca certificates libffi dev bash postgresql libs postgresql dev
--->使用缓存
--->5ca54839bb7c
步骤4/7:运行python3-m ensurepip
--->使用缓存
--->03d95f700108
步骤5/7:运行pip安装--升级pip
--->使用缓存
--->e462d855f07f
步骤6/7:复制requirements.txt/app/requirements.txt
--->f69aa355732a
步骤7/7:运行pip3安装-r/app/requirements.txt
--->在d75911af46c7中运行
集水罐+https://gitlab%2Bdeploy-令牌-171703:***@gitlab.com/example/lib。git@f75285be6ee56360d6f0cfbf64f09a86819def5c(来自-r/app/requirements.txt(第2行))
克隆https://gitlab%2Bdeploy-token-171703:***@gitlab.com/example/lib.git(修订版f75285be6ee56360d6f0cfbf64f09a86819def5c)至/tmp/pip-req-build-yt5mk7q5
正在运行命令git clone-q'https://gitlab%2Bdeploy-令牌-171703:***@gitlab.com/example/lib.git'/tmp/pip-req-build-yt5mk7q5
收集Cython==0.29.17
下载Cython-0.29.17-py2.py3-none-any.whl(971KB)
收集psychrolib==2.5.0
下载PsychroLib-2.5.0.zip(9.5kb)
收集流入xdB==5.2.2
下载xdb-5.2.2-py2.py3-none-any.whl(70 kB)
正在收集configparser==3.5.0
下载configparser-3.5.0.tar.gz(39 kB)
收集报告实验室
下载reportlab-3.5.42.tar.gz(2.9 MB)
收集PyPDF2
下载PyPDF2-1.26.0.tar.gz(77KB)
正在收集matplotlib>=2.2.2
下载matplotlib-3.2.1.tar.gz(40.3 MB)
错误:命令出错,退出状态为1:
命令:/usr/local/bin/python-c'import sys、setuptools、tokenize;sys.argv[0]=“”/tmp/pip-install-mqz7vwwc/matplotlib/setup.py”“”__文件_u979;=“””/tmp/pip-install-mqz7vwwc/matplotlib/setup.py“”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,“'exec'”)'egg\u info--egg base/tmp/pip-install-mqz7vwwc/matplotlib/pip egg info
cwd:/tmp/pip-install-mqz7vwwc/matplotlib/
完整输出(112行):
处理numpy/random/_-bounded_integers.pxd.in
处理numpy/random/_-bounded_integers.pyx.in
回溯(最近一次呼叫最后一次):
文件“/tmp/easy\u install-ho\u rizu1/numpy-1.18.4/tools/cythonize.py”,第61行,进程中
从Cython.Compiler.Version导入版本为Cython\u版本
ModuleNotFoundError:没有名为“Cython”的模块
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py”,第238行,中
main()
文件“/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py”,第234行,主文件
查找进程文件(根目录)
文件“/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py”,第225行,在find_process_文件中
进程(根目录、fromfile、tofile、函数、散列数据库)
文件“/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py”,第191行,正在处理中
处理器函数(fromfile,tofile)
文件“/tmp/easy\u install-ho\u rizu1/numpy-1.18.4/tools/cythonize.py”,第94行,进程中
进程_pyx(pyxfile,tofile)
文件“/tmp/easy\u install-ho\u rizu1/numpy-1.18.4/tools/cythonize.py”,第66行,进程中
raise OSError('Cython需要作为模块安装在Python中')
OSError:Cython需要作为一个模块安装在Python中
从numpy源目录运行。
/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py:461:UserWarning:Unrecognized setuptools命令,继续生成Cython源并展开模板
运行\u build=parse\u setuppy\u命令()
回溯(最近一次呼叫最后一次):
文件“/usr/local/lib/python3.6/site packages/setuptools/sandbox.py”,第154行,在save_模块中
节省的产量
文件“/usr/local/lib/python3.6/site packages/setuptools/sandbox.py”,第195行,在安装程序上下文中
产量
文件“/usr/local/lib/python3.6/site packages/setuptools/sandbox.py”,第250行,在运行设置中
_execfile(设置脚本,ns)
文件“/usr/local/lib/python3.6/site packages/setuptools/sandbox.py”,第45行,在
执行官(代码、全局、局部)
文件“/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py”,第488行,在
文件“/tmp/easy\u install-ho\u rizu1/numpy-1.18.4/setup.py”,第469行,安装程序包中
文件“/tmp/easy\u install-ho\u rizu1/numpy-1.18.4/setup.py”,第275行,在generate\u cython中
)
运行时错误:运行cythonize失败!
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/tmp/pip-install-mqz7vwwc/matplotlib/setup.py”,第274行,在
cmdclass=cmdclass,
文件“/usr/local/lib/python3.6/site packages/setuptools/_uinit__;.py”,第139行,在安装程序中
_安装\u安装\u需要(属性)
文件“/usr/local/lib/python3.6/site packages/setuptools/\uuuuu init\uuuuuuu.py”,第134行,在安装程序中
dist.fetch\u build\u鸡蛋(dist.setup\u需要)
文件“/usr/local/lib/python3.6/site packages/setuptools/dist.py”,第51行
RUN pip3 install Cython