Re: [Rdkit-discuss] rdkit.Chem.Draw.spingCanvas.py (and py27 aggdraw / cairo help?)

2011-06-11 Thread James Davidson
Hi Greg,

 Greg wrote: 
 The attached .pyd is 32-bit aggdraw build for python2.7 on 
 windows. I tested it very briefly and it seems to work; let 
 me know if you have problems with it.

It works a treat - very much appreciated!  My molecules have never
looked better  : )

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
Oakdene Court
613 Reading Road
Winnersh, Berkshire
RG41 5UA.
Tel: +44 118 977 3133

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the Company address and 
registration details link at the bottom of the page..
__

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] rdkit.Chem.Draw.spingCanvas.py (and py27 aggdraw / cairo help?)

2011-06-10 Thread Riccardo Vianello
Hi James,

On Thu, Jun 9, 2011 at 8:22 PM, James Davidson j.david...@vernalis.com wrote:
 [...]
 File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\__init__.py, line 54, in
 MolToImage
     canvas = Canvas(img)
   File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\cairoCanvas.py, line
 38, in __init__
     imgd = image.tostring(raw,BGRA)
   File C:\Python26\lib\site-packages\PIL\Image.py, line 516, in tostring
     e = _getencoder(self.mode, encoder_name, args)
   File C:\Python26\lib\site-packages\PIL\Image.py, line 389, in
 _getencoder
     return apply(encoder, (mode,) + args + extra)
 type 'exceptions.SystemError': unknown raw mode

I don't know exactly about the other problems, but this one should be
related to the version of the installed PIL. If I remember correctly,
BGRA raw mode requires PIL 1.1.7.

Regards,
Riccardo

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] rdkit.Chem.Draw.spingCanvas.py (and py27 aggdraw / cairo help?)

2011-06-10 Thread James Davidson
Dear Greg, Riccardo, et al.


 Riccardo wrote:
 I don't know exactly about the other problems, but this one 
 should be related to the version of the installed PIL. If I 
 remember correctly, BGRA raw mode requires PIL 1.1.7.

@Riccardo - 
Thanks for the advice, Riccardo.  I think I was already on 1.1.7 - but
maybe an alpha release(?)  Anyway, I have now standardised across Python
2.6 and 2.7 with the latest PIL installers from
http://www.pythonware.com/products/pil/.


 Greg wrote: 
 I will try to do an aggdraw build for 2.7. If I succeed, I'll 
 post something.

@Greg -
Thanks for the kind offer.  I for one would be very pleased to be using
aggdraw again (as I think the image quality seems the best).  I am
pleased to say, however, that it is less critical now that I have worked
through my cairo issues!  : )


Previously I was getting:

Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit
(Intel)] on win32
Type copyright, credits or license() for more information.
 from rdkit import Chem
 from rdkit.Chem import AllChem, Draw
 mol = Chem.MolFromSmiles(c1c1)
 AllChem.Compute2DCoords(mol)
 im = Draw.MolToImage(mol)
!!!PYTHONW.EXE CRASH!!!


Finally, after a morning of going round in circles (and following
red-herring Dependency Walker trails(!)), things are running well; with
RDKit now happily calling cairo!  I thought it might be useful for
others to list the versions of software / DLLs that I finally found to
work:

Windows XP Pro. SP3 (32-bit)
Python 2.7.1 (http://www.python.org/ftp/python/2.7.1/python-2.7.1.msi)
PIL 1.1.7 (installer -
http://effbot.org/downloads/PIL-1.1.7.win32-py2.7.exe)
Pycairo-1.8.10.win32-py2.7 (installer -
http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.8/pycairo-1.8.10
.win32-py2.7.exe)
Libcairo-2.dll (get from the following archive:
http://wxpython.org/cairo/cairo_1.8.6-1_win32.zip)
libpng12-0.dll (get from the following archive:
http://wxpython.org/cairo/libpng_1.2.34-1_win32.zip)
Zlib1.dll (get from the following archive:
http://wxpython.org/cairo/zlib123-dll.zip)

I then put the 3 DLLs into the C:\Python27\Lib\site-packages\cairo\
folder, and made sure that this is on the system path.  The use of the
wxPython DLLs seemed to be the key to sorting things out (I certainly
tried a few other versions!) - thanks to Alex Matan's blog-post for the
instructions
(http://electromagnetictelegraph.com/install-cairo-wxpyton-pycairo-pytho
n-windows)

The setup under 2.6 was exactly the same - except I used the
corresponding 2.6 installer for PIL, and used the
Pycairo-1.8.4.win32-py26 from the wxPython site
(http://wxpython.org/cairo/pycairo-1.8.4.win32-py2.6.exe) as detailed in
Alex's blog.


I can add these instructions to to the wiki if you like(?)

Kind regards

James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
Oakdene Court
613 Reading Road
Winnersh, Berkshire
RG41 5UA.
Tel: +44 118 977 3133

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the Company address and 
registration details link at the bottom of the page..
__

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] rdkit.Chem.Draw.spingCanvas.py (and py27 aggdraw / cairo help?)

2011-06-09 Thread James Davidson
Dear All,
 
I am in the process of upgrading to python 2.7 under Windows, and part
of this has included moving to the RDKit_2011_03_2 (py27) build.  I had
previously done most work with earlier versions of RDKit under python
2.6, but have found a problem with calling Draw.MolToImage() with the
latest RDKit binary for both py26 and py27:
 
Traceback (innermost last):
  File C:\Python26\lib\site-packages\Pmw\Pmw_1_3\lib\PmwBase.py, line
1747, in __call__
return apply(self.func, args)
  File C:\Python26\lib\site-packages\pmg_tk\startup\VerMOL.py, line
1188, in lambda
command=lambda
s=self:s.draw_ligand(self.modelling_chainlist.listbox, self.ligcanvas,
self.smiles, '3D',200,200, 'modelling_lig_image'))
  File C:\Python26\lib\site-packages\pmg_tk\startup\VerMOL.py, line
2871, in draw_ligand
im = Draw.MolToImage(mol, size=(x,y))
  File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\__init__.py, line
71, in MolToImage
drawer.AddMol(mol,**kwargs)
  File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\MolDrawing.py, line
361, in AddMol
color=color,width=width,color2=color2)
  File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\MolDrawing.py, line
190, in _drawBond
dash=self.dash)
  File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\MolDrawing.py, line
169, in _drawWedgedBond
 
self.canvas.addCanvasDashedWedge(poly[0],poly[1],poly[2],color=color)
  File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\spingCanvas.py,
line 104, in addCanvasDashedWedge
pts1 = _getLinePoints(p1,p2,dash)
type 'exceptions.NameError': global name '_getLinePoints' is not
defined
 
 
Not a big problem to sort - I think spingCanvas.addCanvasDashedWedge()
should read:
 
pts1 = self._getLinePoints(p1,p2,dash)
pts2 = self._getLinePoints(p1,p3,dash)
 
on lines 104, 105 instead of:
 
pts1 = _getLinePoints(p1,p2,dash)
pts2 = _getLinePoints(p1,p3,dash)
 
 
Anyway, this is only a problem if spingCanvas is being called - which I
think only happens as a last resort if aggdraw or cairo aren't found.
So on that note, the reason I was calling spingCanvas was that I don't
have a build of aggdraw for python 2.7, and I have found that when
cairo/pycairo are available to python 2.7 I get a pythonw.exe
Application Error at the point of calling Draw.MolToImage().  Under
python 2.6 I thought I would see what would happen if I removed aggdraw
to force cairo into play (different version of PIL, different version of
cairo - not an ideal comparison!):
 
File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\__init__.py, line 54,
in MolToImage
canvas = Canvas(img)
  File C:\Python26\RDKit_2011_03_2\rdkit\Chem\Draw\cairoCanvas.py,
line 38, in __init__
imgd = image.tostring(raw,BGRA)
  File C:\Python26\lib\site-packages\PIL\Image.py, line 516, in
tostring
e = _getencoder(self.mode, encoder_name, args)
  File C:\Python26\lib\site-packages\PIL\Image.py, line 389, in
_getencoder
return apply(encoder, (mode,) + args + extra)
type 'exceptions.SystemError': unknown raw mode
 
 
If it helps, I can follow-up with more details on exact versions of
DLLs, etc; but for now wondered if:
 
(a) anybody had a version of aggdraw for windows, built with python 2.7?
(b) or any recommendations for reliable PIL / cairo / pycairo
combinations for python 2.7 / windows?
 
Kind regards
 
 
James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
Oakdene Court
613 Reading Road
Winnersh, Berkshire
RG41 5UA.
Tel: +44 118 977 3133

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the Company address and 
registration details link at the bottom of the page..
__--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.