Davide Targa website

Programming, web development and open source

Installazione Di Plone/Zope Con Pythonbrew E Virtualenv

Il setup utilizzato per questa installazione di Zope/Plone fa uso di Pythonbrew. Ho installato quindi pythonbrew e la versione 2.4.5 dell’interprete Python come descritto in questo mio post precedente.

Dopo di questo ho installato virtualenv per mezzo di easy_install e ho creato un nuovo virtualenv. In questo caso chiamiamo la cartella di lavoro con il nome devel. Dobbiamo attivare ora il virtualenv appena creato. Spostiamoci quindi dentro la cartella devel con il comando:

1
$ cd devel

e attiviamo il virtualenv con:

1
2
$ source bin/activate
(devel)

Notiamo che il prompt dei comandi riporta il nome del virtualenv attivo. Da questo punto in poi lavoreremo sempre all’interno di questo virtualenv.

Si procede installando ZopeSkel sempre per mezzo di easy_install alla versione 2.13 come spiegato qui. A questo punto ho generato con paster un buildout di plone 3 con il comando:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(devel)$ paster create -t plone3_buildout
Selected and implied templates:
ZopeSkel#plone3_buildout A buildout for Plone 3 projectsEnter project name: .
Variables:
egg: .
package:
project: .
Enter plone_version (Which Plone version to install) ['3.3.1']: 3.3.5
Enter zope2_install (Path to Zope 2 installation; leave blank to fetch one) ['']:
Enter plone_products_install (Path to directory containing Plone products; leave blank to fetch one) ['']:
Enter zope_user (Zope root admin user) ['admin']:
Enter zope_password (Zope root admin password) ['']: admin
Enter http_port (HTTP port) [8080]:
Enter debug_mode (Should debug mode be "on" or "off"?) ['off']:
Enter verbose_security (Should verbose security be "on" or "off"?) ['off']:
Creating template plone3_buildout
Copying README.txt to ././README.txt
Copying bootstrap.py to ././bootstrap.py
Copying buildout.cfg_tmpl to ././buildout.cfg
Recursing into products
Creating ././products/
Copying README.txt to ././products/README.txt
Recursing into src
Creating ././src/
Copying README.txt to ././src/README.txt
Recursing into var
Creating ././var/
Copying README.txt to ././var/README.txt
-----------------------------------------------------------
Generation finished
You probably want to run python bootstrap.py and then edit
buildout.cfg before running bin/buildout -v

See README.txt for details
-----------------------------------------------------------

Come possiamo vedere dall’output del comando, lo script ci pone diverse domande, come la versione di Plone (io ho usato la 3.3.5), il nome utente e la password per l’amministrazione, ecc…

Al termine lo script genera i files necessari alla creazione di un’applicazione Zope/Plone. Lanciamo ora lo script bootstrap.py per la generazione della struttura di base della nostra applicazione con il comando:

1
2
3
4
5
6
7
(devel)$ python bootstrap.py
Creating directory '/home/davide/sites/devel/parts'.
Creating directory '/home/davide/sites/devel/eggs'.
Creating directory '/home/davide/sites/devel/develop-eggs'.
Getting distribution for 'zc.buildout==1.4.3'.
Got zc.buildout 1.4.3.
Generated script '/home/davide/sites/devel/bin/buildout'.

Lanciamo quindi il buildout con:

1
$ bin/buildout

Verranno installati tutti i prodotti necessari al funzionamento di Zope/Plone. Al termine possiamo lanciare il comando:

1
$ bin/instance fg

per verificare che l’installazione sia andata a buon fine. Se è tutto ok, dopo qualche secondo otterremo il messaggio

1
"2011-10-17 16:55:12 INFO Zope Ready to handle requests"

Io non sono stato così fortunato. Ecco l’errore che si è presentato all’avvio dell’istanza di Zope:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$ bin/instance fg
/home/davide/sites/devel/parts/instance/bin/runzope -X debug-mode=on
2011-10-17 16:35:15 INFO ZServer HTTP server started at Mon Oct 17 16:35:15 2011
Hostname: 0.0.0.0
Port: 8080
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_png : No module named PIL.Image
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_gif : No module named PIL.Image
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_jpeg : No module named PIL.Image
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_pcx : No module named PIL.Image
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_ppm : No module named PIL.Image
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_tiff : No module named PIL.Image
2011-10-17 16:35:16 ERROR PortalTransforms Problem importing module image_to_bmp : No module named PIL.Image
2011-10-17 16:35:16 INFO Archetypes Products.Archetypes-1.5.15-py2.4.egg/Products/Archetypes/Field.py[103]:?
Warning: no Python Imaging Libraries (PIL) found.Archetypes based ImageField's don't scale if neccessary.

2011-10-17 16:35:16 ERROR Application Could not import Products.ATContentTypes
Traceback (most recent call last):
File "/home/davide/sites/devel/parts/zope2/lib/python/OFS/Application.py", line 709, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/__init__.py", line 64, in ?
import Products.ATContentTypes.content
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/content/__init__.py", line 26, in ?
import Products.ATContentTypes.content.link
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/content/link.py", line 39, in ?
from Products.ATContentTypes.content.base import registerATCT
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/content/base.py", line 63, in ?
from Products.CMFPlone.PloneFolder import ReplaceableWrapper
File "/home/davide/sites/devel/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/__init__.py", line 215, in ?
from browser import ploneview
File "/home/davide/sites/devel/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/browser/ploneview.py", line 12, in ?
from Products.CMFPlone import utils
File "/home/davide/sites/devel/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/utils.py", line 6, in ?
from PIL import Image
ImportError: No module named PIL
Traceback (most recent call last):
File "/home/davide/sites/devel/parts/zope2/lib/python/Zope2/Startup/run.py", line 56, in ?
run()
File "/home/davide/sites/devel/parts/zope2/lib/python/Zope2/Startup/run.py", line 21, in run
starter.prepare()
File "/home/davide/sites/devel/parts/zope2/lib/python/Zope2/Startup/__init__.py", line 102, in prepare
self.startZope()
File "/home/davide/sites/devel/parts/zope2/lib/python/Zope2/Startup/__init__.py", line 278, in startZope
Zope2.startup()
File "/home/davide/sites/devel/parts/zope2/lib/python/Zope2/__init__.py", line 47, in startup
_startup()
File "/home/davide/sites/devel/parts/zope2/lib/python/Zope2/App/startup.py", line 45, in startup
OFS.Application.import_products()
File "/home/davide/sites/devel/parts/zope2/lib/python/OFS/Application.py", line 686, in import_products
import_product(product_dir, product_name, raise_exc=debug_mode)
File "/home/davide/sites/devel/parts/zope2/lib/python/OFS/Application.py", line 709, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/__init__.py", line 64, in ?
import Products.ATContentTypes.content
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/content/__init__.py", line 26, in ?
import Products.ATContentTypes.content.link
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/content/link.py", line 39, in ?
from Products.ATContentTypes.content.base import registerATCT
File "/home/davide/sites/devel/eggs/Products.ATContentTypes-1.3.4-py2.4.egg/Products/ATContentTypes/content/base.py", line 63, in ?
from Products.CMFPlone.PloneFolder import ReplaceableWrapper
File "/home/davide/sites/devel/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/__init__.py", line 215, in ?
from browser import ploneview
File "/home/davide/sites/devel/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/browser/ploneview.py", line 12, in ?
from Products.CMFPlone import utils
File "/home/davide/sites/devel/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/utils.py", line 6, in ?
from PIL import Image
ImportError: No module named PIL

Il messaggio di errore è abbastanza chiaro: Zope non è stato in grado di trovare le librerie PIL per la gestione delle immagini. Procediamo quindi con l’installazione delle librerie PIL. Sempre dalla cartella principale dell’applicazione e con il virtualenv attivo (nel mio caso devel), e installiamo le librerie PIL con easy_install. Il comando da utilizzare sarebbe quindi:

1
(devel)$ easy_install pil

questo installerebbe PIL, ma Zope continuerebbe a non funzionare. Utilizziamo invece il comando:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(devel)$ easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz
Downloading http://dist.repoze.org/PIL-1.1.6.tar.gz
Processing PIL-1.1.6.tar.gz
Running PIL-1.1.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-FGDthi/PIL-1.1.6/egg-dist-tmp-uzBvH_
libImaging/Effects.c:209:1: warning: ‘perlin_init’ defined but not used
libImaging/File.c: In function ‘ImagingOpenPPM’:
libImaging/File.c:112:11: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
libImaging/File.c:119:8: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
libImaging/Geometry.c:235:1: warning: ‘quadratic_transform’ defined but not used
libImaging/Quant.c:310:1: warning: ‘test_sorted’ defined but not used
libImaging/Quant.c:675:1: warning: ‘checkContained’ defined but not used
libImaging/QuantHash.c:136:12: warning: ‘_hashtable_test’ defined but not used
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version 1.1.6
platform linux2 2.4.5 (#1, Oct 17 2011, 15:20:57)
[GCC 4.5.2]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
zip_safe flag not set; analyzing archive contents...
PIL.Image: module references __file__
Removing PIL 1.1.7 from easy-install.pth file
Adding PIL 1.1.6 to easy-install.pth file
Installing pilconvert.py script to /home/davide/sites/devel/bin
Installing pildriver.py script to /home/davide/sites/devel/bin
Installing pilfile.py script to /home/davide/sites/devel/bin
Installing pilfont.py script to /home/davide/sites/devel/bin
Installing pilprint.py script to /home/davide/sites/devel/bin

Installed /home/davide/sites/devel/lib/python2.4/site-packages/PIL-1.1.6-py2.4-linux-i686.egg
Processing dependencies for PIL==1.1.6
Finished processing dependencies for PIL==1.1.6

A questo punto possiamo avviare il server Zope

1
(devel)$ bin/instance fg

che dovrebbe partire correttamente.

Comments