【问题标题】:pip install Failed in OpenShift, the error info is Permission Deniedpip install 在 OpenShift 中失败,错误信息是 Permission Denied
【发布时间】:2014-10-17 20:53:37
【问题描述】:

当我在 OpenShift 中 git push 并重建我的 DIY 应用程序时,pip 安装失败,错误是 Permission Denied。有人知道为什么吗?

我不知道为什么 pip 会将 .pip 写入/var/lib/openshift/513b50c74382ec1582000797/ 路径。

remote: Building git ref 'master', commit 35344b7
remote: Requirement already satisfied (use --upgrade to upgrade): Flask==0.9 in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 1))
remote: Requirement already satisfied (use --upgrade to upgrade): markdown in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 2))
remote: Requirement already satisfied (use --upgrade to upgrade): tornado==1.2.1 in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 3))
remote: Requirement already satisfied (use --upgrade to upgrade): uWSGI==1.4.4 in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 4))
remote: Requirement already satisfied (use --upgrade to upgrade): PyRSS2Gen in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 5))
remote: Requirement already satisfied (use --upgrade to upgrade): pygments in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 6))
remote: Downloading/unpacking Flask-Cache==0.13 (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 7))
remote: Exception:
remote: Traceback (most recent call last):
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
remote:     status = self.run(options, args)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
remote:     requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 971, in prepare_files
remote:     location = req_to_install.build_location(self.build_dir, not self.is_download)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 153, in build_locatio
remote:     _make_build_dir(build_dir)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1225, in _make_build_dir
remote:     os.makedirs(build_dir)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/os.py", line 157, in makedirs
remote:     mkdir(name, mode)
remote: OSError: [Errno 13] Permission denied: '/var/lib/openshift/513b50c74382ec1582000797/build'
remote: 
remote: Storing complete log in /var/lib/openshift/513b50c74382ec1582000797/.pip/pip.log
remote: Traceback (most recent call last):
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data//bin/pip", line 8, in <module>
remote:     load_entry_point('pip==1.1', 'console_scripts', 'pip')()
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 116, in main
remote:     return command.main(args[1:], options)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 141, in main
remote:     log_fp = open_logfile(log_fn, 'w')
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 165, in open_logfile
remote:     os.makedirs(dirname)
remote:   File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/os.py", line 157, in makedirs
remote:     mkdir(name, mode)
remote: OSError: [Errno 13] Permission denied: '/var/lib/openshift/513b50c74382ec1582000797/.pip'
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute action hook 'build' for 513b50c74382ec1582000797 application py27
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.

【问题讨论】:

  • 你在那个目录有写权限吗?

标签: python git openshift


【解决方案1】:

看起来 pip install 默认尝试将一些信息写入您的主目录,而您在 openshift 上无权写入。您是否尝试过使用其中一种预先构建的 python 墨盒?它们被设置为正确安装您在应用程序中定义的包。

如果您一心想要使用 DIY 设备,您至少可以查看默认 python 墨盒的代码,看看它们如何解决同样的问题:https://github.com/openshift/origin-server/tree/master/cartridges

【讨论】:

    猜你喜欢
    • 2021-03-04
    • 2016-08-17
    • 2014-05-10
    • 2015-07-05
    • 2016-08-07
    • 2020-06-04
    • 1970-01-01
    • 2017-04-16
    相关资源
    最近更新 更多