ostrokach / cinfony

Automatically exported from code.google.com/p/cinfony
1 stars 1 forks source link

Cinfony 1.1b2 not working with Debian's CDK (both jpype and jython) #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

How to reproduce it:
ssorgatem:/tmp$ export JPYPE_JVM=/usr/lib/jvm/java-6-openjdk/jre/lib/
amd64/server/libjvm.so

ssorgatem:/tmp$ python
Python 2.6.6 (r266:84292, Apr 20 2011, 09:34:38)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information
.   
>>> import os, glob
>>> classpath = ":".join(glob.glob('/usr/share/java/cdk*.jar'))
>>> classpath
'/usr/share/java/cdk-structgen.jar:/usr/share/java/cdk-structgen-1.2.8.jar:/usr/
share/java/cdk-libiocml-1.2.8.jar:/usr/share/java/cdk-core.jar:/usr/share/java/c
dk-standard-1.2.8.jar:/usr/share/java/cdk-io-1.2.8.jar:/usr/share/java/cdk-build
er3dtools-1.2.8.jar:/usr/share/java/cdk-reaction-1.2.8.jar:/usr/share/java/cdk-s
miles.jar:/usr/share/java/cdk-smarts-1.2.8.jar:/usr/share/java/cdk-control-1.2.8
.jar:/usr/share/java/cdk-pdbcml.jar:/usr/share/java/cdk-sdg.jar:/usr/share/java/
cdk-builder3dtools.jar:/usr/share/java/cdk-builder3d-1.2.8.jar:/usr/share/java/c
dk-pdbcml-1.2.8.jar:/usr/share/java/cdk-qsarprotein.jar:/usr/share/java/cdk-forc
efield-1.2.8.jar:/usr/share/java/cdk-data.jar:/usr/share/java/cdk-charges-1.2.8.
jar:/usr/share/java/cdk-qsaratomic.jar:/usr/share/java/cdk-annotation.jar:/usr/s
hare/java/cdk-qm-1.2.8.jar:/usr/share/java/cdk-ionpot-1.2.8.jar:/usr/share/java/
cdk-nonotify.jar:/usr/share/java/cdk-smarts.jar:/usr/share/java/cdk-core-1.2.8.j
ar:/usr/share/java/cdk-ioformats.jar:/usr/share/java/cdk-diff.jar:/usr/share/jav
a/cdk-pcore.jar:/usr/share/java/cdk-valencycheck-1.2.8.jar:/usr/share/java/cdk-c
ontrol.jar:/usr/share/java/cdk-standard.jar:/usr/share/java/cdk-builder3d.jar:/u
sr/share/java/cdk-annotation-1.2.8.jar:/usr/share/java/cdk-valencycheck.jar:/usr
/share/java/cdk-libiocml.jar:/usr/share/java/cdk-qsarmolecular.jar:/usr/share/ja
va/cdk-qsarionpot.jar:/usr/share/java/cdk-dict.jar:/usr/share/java/cdk-charges.j
ar:/usr/share/java/cdk-qsarionpot-1.2.8.jar:/usr/share/java/cdk-nonotify-1.2.8.j
ar:/usr/share/java/cdk-forcefield.jar:/usr/share/java/cdk-inchi.jar:/usr/share/j
ava/cdk-render-1.2.8.jar:/usr/share/java/cdk-pdb-1.2.8.jar:/usr/share/java/cdk-e
xtra-1.2.8.jar:/usr/share/java/cdk-formula-1.2.8.jar:/usr/share/java/cdk-atomtyp
e-1.2.8.jar:/usr/share/java/cdk-extra.jar:/usr/share/java/cdk-io.jar:/usr/share/
java/cdk-render.jar:/usr/share/java/cdk-libiomd-1.2.8.jar:/usr/share/java/cdk-qs
ar-1.2.8.jar:/usr/share/java/cdk-dict-1.2.8.jar:/usr/share/java/cdk-pcore-1.2.8.
jar:/usr/share/java/cdk-data-1.2.8.jar:/usr/share/java/cdk-qsarbond.jar:/usr/sha
re/java/cdk-interfaces.jar:/usr/share/java/cdk-reaction.jar:/usr/share/java/cdk-
atomtype.jar:/usr/share/java/cdk-ionpot.jar:/usr/share/java/cdk-isomorphism-1.2.
8.jar:/usr/share/java/cdk-formula.jar:/usr/share/java/cdk-fingerprint.jar:/usr/s
hare/java/cdk-diff-1.2.8.jar:/usr/share/java/cdk-isomorphism.jar:/usr/share/java
/cdk-libiomd.jar:/usr/share/java/cdk-smiles-1.2.8.jar:/usr/share/java/cdk-ioform
ats-1.2.8.jar:/usr/share/java/cdk-qsarmolecular-1.2.8.jar:/usr/share/java/cdk-qs
arcml-1.2.8.jar:/usr/share/java/cdk-sdg-1.2.8.jar:/usr/share/java/cdk-fingerprin
t-1.2.8.jar:/usr/share/java/cdk-inchi-1.2.8.jar:/usr/share/java/cdk-qsarprotein-
1.2.8.jar:/usr/share/java/cdk-qsar.jar:/usr/share/java/cdk-pdb.jar:/usr/share/ja
va/cdk-qsarcml.jar:/usr/share/java/cdk-qm.jar:/usr/share/java/cdk-qsarbond-1.2.8
.jar:/usr/share/java/cdk-interfaces-1.2.8.jar:/usr/share/java/cdk-qsaratomic-1.2
.8.jar'
>>> os.environ['CLASSPATH']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/UserDict.py", line 22, in __getitem__
    raise KeyError(key)
KeyError: 'CLASSPATH'
>>> os.environ['CLASSPATH'] = classpath
>>> from cinfony import cdk
/usr/lib/pymodules/python2.6/jpype/_pykeywords.py:18: DeprecationWarning: the 
sets module is deprecated
  import sets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdk.py", line 13, in <module>
    from cdkjpype import *
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdkjpype.py", line 59, in <module>
    _descdict = _getdescdict()
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdkjpype.py", line 48, in _getdescdict
    de = cdk.qsar.DescriptorEngine(cdk.qsar.DescriptorEngine.MOLECULAR)  
  File "/usr/lib/pymodules/python2.6/jpype/_jclass.py", line 79, in _javaInit
    self.__javaobject__ = self.__class__.__javaclass__.newClassInstance(*args)
jpype._jexception.LinkageErrorPyRaisable: java.lang.NoClassDefFoundError: 
nu/xom/ParsingException
>>>

However, it works if I use the cdk-1.2.8.jar from 
http://sourceforge.net/projects/cdk/ as the only item in the classpath.

It doesn't work from jython, either:

ssorgatem:/tmp$ jython
Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_24
Type "help", "copyright", "credits" or "license" for more information.
>>> from cinfony import cdk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/share/jython/Lib/site-packages/cinfony/cdk.py", line 11, in <module>
    from cdkjython import *
  File "/usr/share/jython/Lib/site-packages/cinfony/cdkjython.py", line 17, in <module>
    import org.openscience.cdk as cdk
ImportError: No module named openscience
>>> 

Original issue reported on code.google.com by ssorga...@gmail.com on 21 May 2011 at 12:56

GoogleCodeExporter commented 9 years ago
This isn't a bug in Cinfony as Cinfony is working as described in the 
installation.

If you suspect that Debian CDK 1.2.8 is not equal to CDK 1.2.8, then please 
contact its Debian maintainers or the CDK development team.

Original comment by baoille...@gmail.com on 23 May 2011 at 1:42

GoogleCodeExporter commented 9 years ago
Debian's CDK is actually split into a bunch of different files...maybe that's 
the issue.

I'll raise the issue to their maintainers.

Thank you.

Original comment by ssorga...@gmail.com on 23 May 2011 at 3:18

GoogleCodeExporter commented 9 years ago
Or maybeit could be the handling of multiple jars in the CLASSPATH by Cinfony?

Can you try unzipping all of the CDK jars into a temporary directory and then 
zipping them together into a single jar and see if that works...?

Original comment by baoille...@gmail.com on 23 May 2011 at 3:29

GoogleCodeExporter commented 9 years ago
I did, but I keep getting the same error as above 
'jpype._jexception.LinkageErrorPyRaisable: java.lang.NoClassDefFoundError: 
nu/xom/ParsingException'

Looks like a missing class.

I tried before unpacking and repacking upstream cdk just to make sure I was 
doing it right, and i worked. If we compare the final directory structures, 
they are a bit different... I'm going to file a bug in debian's BTS.

Original comment by ssorga...@gmail.com on 23 May 2011 at 4:03

GoogleCodeExporter commented 9 years ago
That last error message show that you forgot to put the xom libraries in your 
classpath:

http://packages.debian.org/search?keywords=libxom-java

/usr/share/java/xom-1.2.1.jar

The huge CDK jar you download from SF contains all the 3rd party libs. Debian 
does not.

Egon

Original comment by egon.wil...@gmail.com on 23 May 2011 at 4:36

GoogleCodeExporter commented 9 years ago
And the jaxen libraries were missing in the classpath, too. I added them, but 
it still doesn't work, but now with a different error:

ssorgatem:/tmp$ python
Python 2.6.6 (r266:84292, Apr 20 2011, 09:34:38) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from glob import glob
>>> import os
>>> os.environ['CLASSPATH'] = ":".join(glob("/usr/share/java/cdk*.jar")) + ":" 
+ ":".join(glob("/usr/share/java/xom*.jar"))+ ":" + 
":".join(glob("/usr/share/java/jaxen*.jar"))
>>> from cinfony import cdk
/usr/lib/pymodules/python2.6/jpype/_pykeywords.py:18: DeprecationWarning: the 
sets module is deprecated
  import sets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdk.py", line 13, in <module>
    from cdkjpype import *
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdkjpype.py", line 74, in <module>
    forcefields = list(cdk.modeling.builder3d.ModelBuilder3D.getInstance().getFfTypes())
  File "/usr/lib/pymodules/python2.6/jpype/_jpackage.py", line 53, in __call__
    raise TypeError, "Package "+self.__name+" is not Callable"
TypeError: Package 
org.openscience.cdk.modeling.builder3d.ModelBuilder3D.getInstance is not 
Callable
>>> 

I don't know  about the CDK API,but something called ".getInstance" looks like 
it should be callable. 

Original comment by ssorga...@gmail.com on 23 May 2011 at 5:56

GoogleCodeExporter commented 9 years ago
That's probably Jama missing from your classpath: libjama-java

Original comment by egon.wil...@gmail.com on 23 May 2011 at 6:03

GoogleCodeExporter commented 9 years ago
It's missing and I didn't have it installed, because of libcdk-java doesn't 
depend on it. 

I installed it and added it to the classpath... and still the same error.

Original comment by ssorga...@gmail.com on 23 May 2011 at 6:25

GoogleCodeExporter commented 9 years ago
> Comment #8 on issue 7 by ssorga...@gmail.com: Cinfony 1.1b2 not working
> It's missing and I didn't have it installed, because of libcdk-java doesn't
> depend on it.

I guess it would be useful if the libcdk-java package would Recommend those 
indeed.

> I installed it and added it to the classpath... and still the same error.

You added vecmath earlier already, right?

libvecmath-java

OK. To not keep iterating all the time, I would like to ask you took 
*.libdepends in this folder:

http://cdk.git.sourceforge.net/git/gitweb.cgi?p=cdk/cdk;a=tree;f=src/META-INF;h=
707275e69041cb2ec66792216909d2295bfe921b;hb=5a358fc50630450fe5e3dda0a3874d337637
d19d

These files define the dependencies for each of the CDK modules... I do not 
know on what CDK modules Cinfony depends, but it gives you some idea of what 
additional jars you are looking for.

You can also look at the build dependencies, as Debian uses those on this page:

http://packages.debian.org/source/wheezy/cdk

Just installing all packages listed there is probably the quickest solution.

Original comment by egon.wil...@gmail.com on 23 May 2011 at 6:35

GoogleCodeExporter commented 9 years ago
I installed all its build dependencies and added them to the classpath:

Python 2.6.6 (r266:84292, Apr 20 2011, 09:34:38) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from glob import glob
>>> 
>>> os.environ['CLASSPATH'] = ":".join(glob("/usr/share/java/cdk*.jar")) + ":" 
+ ":".join(glob("/usr/share/java/xom*.jar"))+ ":" + 
":".join(glob("/usr/share/java/jaxen*.jar")) + ":" + 
":".join(glob("/usr/share/java/jama*.jar"))+ ":" + 
":".join(glob("/usr/share/java/vecmath*.jar"))+ ":" + 
":".join(glob("/usr/share/java/crimson*.jar"))+ ":" + 
":".join(glob("/usr/share/java/jgraph*.jar"))+ ":" + 
":".join(glob("/usr/share/java/mysql*.jar"))+ ":" + 
":".join(glob("/usr/share/java/pg*.jar"))+ ":" + 
":".join(glob("/usr/share/java/xpp*.jar"))+ ":" + 
":".join(glob("/usr/share/java/xerces*.jar"))+ ":" + 
":".join(glob("/usr/share/java/xml*.jar"))
>>> 
>>> from cinfony import cdk
/usr/lib/pymodules/python2.6/jpype/_pykeywords.py:18: DeprecationWarning: the 
sets module is deprecated
  import sets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdk.py", line 13, in <module>
    from cdkjpype import *
  File "/usr/local/lib/python2.6/dist-packages/cinfony/cdkjpype.py", line 77, in <module>
    _isofact = cdk.config.IsotopeFactory.getInstance(cdk.ChemObject().getBuilder())
jpype._jexception.ExceptionPyRaisable: java.io.IOException: There was a problem 
getting org.openscience.cdk.config.isotopes.xml as a stream

I think I'll just give up trying to use the debian package. Anyway, I think the 
package dependencies are buggy, as it states it depends solely on 
default-jre-headless | java5-runtime-headless

Original comment by ssorga...@gmail.com on 23 May 2011 at 7:04

GoogleCodeExporter commented 9 years ago
The Debian maintainers should be running the CDK test suite as part of their QA 
when preparing the package. That should pick up on any missing dependencies, 
right?

Original comment by baoille...@gmail.com on 23 May 2011 at 7:10

GoogleCodeExporter commented 9 years ago
Noel, the test suite is not part of the source distribution. Don't remember why 
not, though.

I can confirm the isotopes.xml missing from the cdk-core.jar.

> I think I'll just give up trying to use the debian package.

Well, you're using Debian testing after all... there is a reason why it is 
called testing.

Anyway, thanx for your persistence... the last thing is a serious bug, though 
this may be a bug on the CDK side.

> Anyway, I think the package dependencies are buggy

Please file a bug report about that.

Original comment by egon.wil...@gmail.com on 23 May 2011 at 7:16

GoogleCodeExporter commented 9 years ago

> Please file a bug report about that.
Done

Thank you both for your patience.

Original comment by ssorga...@gmail.com on 23 May 2011 at 7:39

GoogleCodeExporter commented 9 years ago
I filed a bug report about the missing .xml files:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627712

Original comment by egon.wil...@gmail.com on 23 May 2011 at 7:41