Re: [Open Babel] Encoding error: python-openbabel/pybel

2017-07-23 Thread Noel O'Boyle
How was Open Babel and Pybel installed?

On 11 July 2017 at 00:46, Keiron O'Shea [keo7]  wrote:
> Hey there,
>
> I'm trying to use pybel, but I seem to be experiencing some sort of encoding 
> error.
>
> Example Code:
>
> ```
> import pybel
>
> print pybel.descs
>
> mol = pybel.readstring("inchi", 
> "InChI=1S/C7H4Cl4/c1-3-6(10)4(8)2-5(9)7(3)11/h2H,1H3")
> print mol.calcdesc()
> ```
>
> Returns:
>
>
> ```
> /usr/bin/python2.7 "/home/keo7/.code_factory/playground/test.py"
> ['0\x0e0\x01', '\xd0\x8d6\x01', 'ecules', 'cansmi', 'cansmiNS', 
> '`\xd8\xff\x15j\x7f', 'formula', 'HBA1', 'HBA2', 'HBD', 'InChI', 'InChIKey', 
> 'tbonds', 'logP', 'MP', 'MR', 'MW', 'nF', 's', 'SmartsDescriptor', 'smarts', 
> 'P\x01', 'title', 'TPSA']
> Traceback (most recent call last):
>   File "/home/keo7/Desktop/DIMEdb playground/dimedb/rdkit_stuff.py", line 6, 
> in 
> print mol.calcdesc()
>   File "/usr/lib/python2.7/dist-packages/pybel.py", line 360, in calcdesc
> raise ValueError("%s is not a recognised Open Babel descriptor type" % 
> descname)
> ValueError: 0 0  is not a recognised Open Babel descriptor type
> ```
>
> My system is running a 64bit installation of Ubuntu 16.04.
>
> Any support would be much appreciated!
>
> Keiron.
>
>
> 
> Un o’r 4 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
> (Arolwg Cenedlaethol y Myfyrwyr 2016)
> www.aber.ac.uk
>
> Top 4 UK university and best in Wales for student satisfaction
> (National Student Survey 2016)
> www.aber.ac.uk
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Pybel: smi is not a recognised Open Babel format

2017-07-23 Thread Noel O'Boyle
Not sure, but just so you know, you will need a different wheel for
each version of Python you wish to support.

Since it works for you with a normal build and install, why not just
copy the relevant .so files out of the install and then use them to
create your wheel. That's how I create the wheels for Windows. You
just need to do this several times to create the wheels for each
version of Python (this doesn't take long once OB itself is built).

- Noel

On 17 July 2017 at 21:36, Oliver Stueker  wrote:
> (The previous email was sent accidentally while I was still composing)
>
> Dear Open Babel developers and community,
>
> I'm currently trying to build a pre-compiled Python wheel for Open Babel
> 2.4.1
> that is to be installed on Compute Canada's HPC clusters so that users can
> quickly install tested python packages into their home directory.
>
> I have already installed Open Babel 2.4.1, which works just fine, but once I
> want to use the pybel installed with "pip install ..." - either from a wheel
> that I have created with "pip wheel openbabel" - or like demonstrated below
> by compiling on installation, I get the error following error when testing:
> "ValueError: smi is not a recognised Open Babel format"
>
> The environment variables BABEL_LIBDIR and BABEL_DATADIR are set correctly
> and when I run ldd on the `_openbabel.so`, it can find all dependencies,
> as our compilers set RUNPATHs for all executables and libraries.
> I have confirm with `readelf -d _openbabel.so` that the RPATH is correctly
> set.
>
> The curious thing is, that before when I installed the Python bindings with
> CMake, it
> worked just fine. The disadvantage with that however is that I can only
> install either
> the Python 2.x or 3.y bindings and that I need to set a PYTHON path in the
> environment module, which can make problems when someone wants to use
> a different Python version.
> Having pre-compiled wheels in a wheelhouse that can swiftly be installed
> in a virtual env is a much cleaner solution.
>
> Below I demonstrate how I load my modules, show that obabel works,
> create a python virtualenv in which the python bindings are installed.
> When running readstring("smi", "") python will throw the error.
>
> Does anyone have an idea where could be the problem?
>
> Oliver
>
>
> $ module load openbabel python/2.7.13
>
> $ module list
> Currently Loaded Modules:
>   1) nixpkgs/16.09 (S)  7) openmpi/2.1.1   (m)
>   2) icc/.2016.4.258   (H)  8) StdEnv/2016.4   (S)
>   3) gcccore/.5.4.0(H)  9) eigen/3.3.2 (math)
>   4) ifort/.2016.4.258 (H) 10) boost/1.60.0(t)
>   5) intel/2016.4  (t) 11) openbabel/2.4.1
>   6) imkl/11.3.4.258   (math)  12) python/2.7.13   (t)
>
> $ echo  | obabel -i smi -o cml -
> 
> http://www.xml-cml.org/schema";>
>  
>   
>   
>   
>   
>  
>  
>   
>   
>   
>  
> 
> 1 molecule converted
>
> $ virtualenv babel
> New python executable in /home/stuekero/openbabel_test/babel/bin/python2.7
> Also creating executable in /home/stuekero/openbabel_test/babel/bin/python
> Installing setuptools, pip, wheel...done.
>
> $ source babel/bin/activate
>
> (babel)$ pip --no-cache-dir install openbabel
> Collecting openbabel
>   Downloading openbabel-2.4.1.tar.gz (74kB)
> 100% || 81kB 6.5MB/s
> Installing collected packages: openbabel
>   Running setup.py install for openbabel ... done
> Successfully installed openbabel-2.4.1
>
> (babel)$ python test_openbabel.py
> Traceback (most recent call last):
>   File "test_openbabel.py", line 4, in 
> mymol = readstring("smi", "")
>   File
> "/home/stuekero/openbabel_test/babel/lib/python2.7/site-packages/pybel.py",
> line 199, in readstring
> raise ValueError("%s is not a recognised Open Babel format" % format)
> ValueError: smi is not a recognised Open Babel format
>
> (babel)$ echo $BABEL_LIBDIR
> /cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/intel2016.4/openbabel/2.4.1/lib/openbabel/2.4.1
>
> (babel)$ echo $BABEL_DATADIR
> /cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/Compiler/intel2016.4/openbabel/2.4.1/share/openbabel/2.4.1
>
> (babel)$ python -c "from pybel import * ; print 'smi' in informats "
> True
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listin