conda-forge / openbabel-feedstock

A conda-smithy repository for openbabel.
BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

Errors when importing pybel from conda environment #33

Open sergio-garay opened 1 year ago

sergio-garay commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Hi all In order to run doglycans i have created an environment with the following commands:

conda create --name doglycans -c conda-forge "python>=3.6" "numpy=1.13.1" "ply>=3.10" conda activate doglycans conda install -c conda-forge "openbabel=2.4.1" Then I run python from a terminal:

import openbabel import pybel Traceback (most recent call last): File "", line 1, in File "/home/sgaray/miniconda3/envs/doglycans1/lib/python3.6/site-packages/pybel.py", line 89, in informats = _formatstodict(_obconv.GetSupportedInputFormat()) File "/home/sgaray/miniconda3/envs/doglycans1/lib/python3.6/site-packages/pybel.py", line 68, in _formatstodict broken = [(x, y.strip()) for x, y in broken] File "/home/sgaray/miniconda3/envs/doglycans1/lib/python3.6/site-packages/pybel.py", line 68, in broken = [(x, y.strip()) for x, y in broken] ValueError: not enough values to unpack (expected 2, got 1)

I'm running a Fedora core 36 OS. I have to say that I didn't have this problem in FC35

Installed packages

# packages in environment at /home/sgaray/miniconda3/envs/doglycans1:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
blas                      1.0                         mkl  
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
cairo                     1.16.0            ha61ee94_1014    conda-forge
expat                     2.5.0                h27087fc_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.1               hc2a2eb6_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               hca18f0e_1    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
intel-openmp              2022.1.0          h9e868ea_3769  
ld_impl_linux-64          2.39                 hcc3a1bd_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgfortran-ng            7.5.0               h14aa051_20    conda-forge
libgfortran4              7.5.0               h14aa051_20    conda-forge
libglib                   2.74.1               h606061b_1    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxml2                   2.10.3               h7463322_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
mkl                       2018.0.3                      1  
ncurses                   6.3                  h27087fc_1    conda-forge
numpy                     1.13.1           py36h5bc529a_2  
openbabel                 2.4.1            py36hc189817_1    conda-forge
openssl                   1.1.1s               h0b41bf4_1    conda-forge
pcre2                     10.40                hc3806b6_0    conda-forge
pip                       21.3.1             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
ply                       3.11                       py_1    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
python                    3.6.15          hb7a2778_0_cpython    conda-forge
python_abi                3.6                     2_cp36m    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
setuptools                58.0.4           py36h5fab9bb_2    conda-forge
sqlite                    3.40.0               h4ff8645_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zlib                      1.2.13               h166bdaf_4    conda-forge

Environment info

active environment : doglycans1
    active env location : /home/sgaray/miniconda3/envs/doglycans1
            shell level : 1
       user config file : /home/sgaray/.condarc
 populated config files : /home/sgaray/.condarc
          conda version : 22.11.1
    conda-build version : not installed
         python version : 3.9.15.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.35=0
                          __linux=6.0.12=0
                          __unix=0=0
       base environment : /home/sgaray/miniconda3  (writable)
      conda av data dir : /home/sgaray/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/sgaray/miniconda3/pkgs
                          /home/sgaray/.conda/pkgs
       envs directories : /home/sgaray/miniconda3/envs
                          /home/sgaray/.conda/envs
               platform : linux-64
             user-agent : conda/22.11.1 requests/2.28.1 CPython/3.9.15 Linux/6.0.12-200.fc36.x86_64 fedora/36 glibc/2.35
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False
fredrikw commented 1 year ago

Since 2.4.1 is really old it may be difficult to get a bug fix here. One could guess that there is a problem with the path settings if it worked with another machine. If you edit /home/sgaray/miniconda3/envs/doglycans1/lib/python3.6/site-packages/pybel.py", line 68 or run it in a debugger you may see what's in the variable broken and maybe get a hint from there...

sergio-garay commented 1 year ago

Thanks for your help fredrikw. As you recommended, I commented out the lines with errors (69 and 89) in pybel.py, after that I could no longer import pybel from a python terminal. It gave this message

ModuleNotFoundError: No module named 'pybel.py'; 'pybel' is not a package

When I uncommented the same lines, it started to find pybel.py again. Could you give me some idea what is going on? Thank you very much

fredrikw commented 1 year ago

I did not mean that you should comment the lines. You should debug or print the values to see if you can get an idea on what is happening. Alternatively, you try to update "doglycans" to use a reasonably recent version of openbabel and retry with that. It might be enough to change how to import pybel...