2015-06-19 16 views
6

Trên một máy chủ, để tối ưu hóa đĩa, chúng tôi không cài đặt một trình biên dịch C, và đây là vấn đề:làm thế nào để buộc buildout sử dụng đã được cài đặt gói

tôi muốn cài đặt 'thúc đẩy' gói python với buildout 2.3.1, spur đang sử dụng pycrypto yêu cầu trình biên dịch C.

Để tránh biên dịch, tôi đã cài đặt trên máy chủ (Suse 11SP2) rpm python-pycrypto (python-pycrypto-2.6-31.7.x86_64.rpm). Tôi có thể kiểm tra với 'pip freeze' mà pycrypto đã được cài đặt:

pip freeze 

lxml==2.1.2 
mod-python==3.3.1 
Numeric==24.2 
numpy==1.3.0 
pycrypto==2.6 
pywbem==0.7.0 
PyXML==0.8.4 

Tuy nhiên, khi tôi bắt đầu xây dựng, nó vẫn cố gắng xây dựng pycrypto bằng trình biên dịch C không tồn tại.

Vì vậy, tôi đã thêm include-site-packages = true và được cho phép-trứng-từ-site-packages = pycrypto trong buildout.cfg, nhưng chúng không được tính đến. Tôi cũng đã cố gắng thực hiện:

python bootstrap.py --allow-site-packages 
bin/buildout 

nhưng điều đó cũng không giúp ích gì.

Tôi có thể làm gì để tránh việc xây dựng biên dịch gói đã được biên dịch và cài đặt từ vòng/phút?

Đây là buildout.cfg

[buildout] 
newest = false 
extensions = gp.vcsdevelop 
develop-dir = src 
parts = eggs tests wsgi 
include-site-packages = true 
allowed-eggs-from-site-packages = pycrypto 

eggs = 
    Django==1.4.8 
    ordereddict 
    ipython==0.13.2 
    django-webtest 
    django-grappelli<2.5.0 
    django-bootstrap3-datetimepicker 
    z3c.recipe.usercrontab 
    rrdgraphs 
    south 
    achilterm 
    pynag 
    pyaml<14 
    DjangoDevKit==1.0.3 
    Sphinx 
    xlwt 
    xlrd 
    spur 

... 

và các bản ghi:

# bin/buildout 
Unused options for buildout: 'allowed-eggs-from-site-packages' 'include-site-packages'. 
Installing eggs. 
Getting distribution for 'pycrypto!=2.4,>=2.1'. 
configure: error: in `/tmp/easy_install-QFXca_/pycrypto-2.6.1': 
configure: error: no acceptable C compiler found in $PATH 
See `config.log' for more details 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 2254, in main 

    File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup 
    dist.run_commands() 
    File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands 
    self.run_command(cmd) 
    File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command 
    cmd_obj.run() 
    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 380, in run 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 610, in easy_install 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 659, in install_item 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 842, in install_eggs 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1070, in build_and_install 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1056, in run_setup 

    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 240, in run_setup 
    File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__ 
    self.gen.throw(type, value, traceback) 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context 
    File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__ 
    self.gen.throw(type, value, traceback) 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 164, in save_modules 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 139, in resume 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 152, in save_modules 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 237, in run_setup 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 267, in run 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 236, in runner 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 46, in _execfile 
    File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 456, in <module> 
    File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup 
    dist.run_commands() 
    File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands 
    self.run_command(cmd) 
    File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command 
    cmd_obj.run() 
    File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 160, in run 
    File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 146, in call_command 
    File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command 
    self.distribution.run_command(command) 
    File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command 
    cmd_obj.run() 
    File "build/bdist.linux-x86_64/egg/setuptools/command/install_lib.py", line 10, in run 
    File "/usr/lib64/python2.6/distutils/command/install_lib.py", line 112, in build 
    self.run_command('build_ext') 
    File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command 
    self.distribution.run_command(command) 
    File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command 
    cmd_obj.run() 
    File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 251, in run 
    File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command 
    self.distribution.run_command(command) 
    File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command 
    cmd_obj.run() 
    File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 278, in run 
RuntimeError: autoconf error 
An error occurred when trying to install pycrypto 2.6.1. Look above this message for any errors that were output by easy_install. 
While: 
    Installing eggs. 
    Getting distribution for 'pycrypto!=2.4,>=2.1'. 
Error: Couldn't install: pycrypto 2.6.1 
+0

nào zc.buildout bạn đang sử dụng? Kiểm tra dòng đầu tiên của đầu ra của bạn: 'Các tùy chọn không sử dụng cho buildout: 'cho phép-trứng-từ-trang web-gói' 'bao gồm-site-packages'.' Có vẻ như các tùy chọn không được công nhận. – Mathias

+0

Tôi đã thực hiện bản khởi động mới nhất và được cài đặt lại, phiên bản là 2.3.1 và nên quản lý các tùy chọn 'cho phép-trứng-từ-trang web-gói' 'bao gồm-site-gói' – Eric

Trả lời

4

Tôi tìm thấy một workaround:

tôi vừa tạo ra một tập tin trứng-link vào phát triển-trứng dir:

$ cat develop-eggs/pycrypto.egg-link 
/usr/lib64/python2.6/site-packages 
0

tôi đã không có bằng chứng cho thấy zc.buildout> 1.7.1 hỗ trợ include-site-packages, cũng không allowed-eggs-from-site-packages.

Trên máy tính địa phương của tôi, tôi đã tìm kiếm cho các tính năng được đề cập trong các phiên bản sau của zc.buildout:

  • zc.buildout-1.4.4-py2.7.egg
  • zc.buildout-1.6 .3-py2.7.egg
  • zc.buildout-1.7.1-py2.7.egg
  • zc.buildout-2.0.0-py2.7.egg
  • zc.buildout-2.0.1 -py2.7.egg
  • zc.buildout-2.1.0-py2.7.egg
  • zc.buildout-2.2.0-py2.7.egg
  • zc.buildout-2.2.1-py2.7.egg
  • zc.buildout-2.2.3-py2.7.egg
  • zc.buildout-2.2.4-py2.7.egg
  • zc.buildout-2.2.5-py2.7.egg
  • zc.buildout-2.3.0-py2.7.egg
  • ZC .buildout-2.3.1-py2.7.egg

Kiểm tra Readme trên https://pypi.python.org/pypi/zc.buildout/1.7.1 . Các tính năng đã được giới thiệu ở đâu đó xung quanh zc.buildout 1.5.0. Bản phát hành cuối cùng, hỗ trợ các tính năng đó là 1.7.1.

Họ đã thực hiện một số loại khởi chạy lại với zc.buildout 2.0.0 ...

Trích từ changlog, phiên bản 2.0.0:

Đây là một phiên bản tương thích ngược của buildout mà cố gắng để sửa chữa sai lầm thực hiện trong buildout 1.

buildout không còn cố gắng cung cấp cách ly hoàn toàn hoặc một phần từ các cài đặt Python hệ thống. Nếu bạn muốn cách ly, hãy sử dụng buildout với virtualenv, hoặc sử dụng một bản xây dựng của Python để bắt đầu.

Trong trường hợp của bạn, điều này có nghĩa là nếu bạn muốn sử dụng các tính năng bạn cần sử dụng zc.buildout 1.7.1.

Điều quan trọng là không thể sử dụng cả hai tùy chọn cùng một lúc. Sử dụng allowed-eggs-from-site-packages (only specific packages) hoặc include-site-packages.

Tôi giả sử bạn đang sử dụng phiên bản boostrap.py 1: http://downloads.buildout.org/1/bootstrap.py

Phiên bản này không hỗ trợ '- cho phép-site-packages' tùy chọn, vì nó được dự định để sử dụng với zc.buildout 1 .x, xử lý trường hợp này (hoặc ít nhất 1.5.x).


Vâng, sau chuyến đi ngắn này trong lịch sử buildout, tôi đoán hai điểm sau đây sẽ giải quyết vấn đề của bạn:

  • Hãy chắc chắn bạn đang sử dụng boostrap.py 2: https://bootstrap.pypa.io/bootstrap-buildout.py. Chỉ phiên bản này hỗ trợ tùy chọn --allow-site-packages.
  • Đảm bảo bạn đang sử dụng phiên bản zc.buildout phù hợp cho yout boostrap.py verson.

Sau đó, python bootstrap.py --allow-site-packages hoạt động như mong đợi.

+0

Vấn đề là 'python bootstrap.py ... 'thực sự đang cài đặt phiên bản mới nhất. Tôi không muốn cài đặt bằng tay một cái cũ vì tôi có thể yêu cầu cái mới nhất vì những lý do khác. Đây là vấn đề về trứng gà. – Eric

+0

nhưng bootstap.py của bạn là từ https://bootstrap.pypa.io/bootstrap-buildout.py? – Mathias

+0

có và 'python bootstrap.py --allow-site-packages' đang cài đặt bản dựng 2.3.1 – Eric

Các vấn đề liên quan