nvictus/pybbi

Not importing bbi

gibcus opened this issue · 10 comments

From the bootcamp, I am using the insulation script, but can't import bbi:

%matplotlib` inline
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
mpl.style.use('seaborn-white')
import multiprocess as mp
import numpy as np
import pandas as pd
import bioframe
import cooltools
import cooler
import bbi
import cython

error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-607bbd995f76> in <module>
     11 import cooltools
     12 import cooler
---> 13 import bbi
     14 import cython

~/miniconda3/envs/cooler-env/lib/python3.6/site-packages/bbi/__init__.py in <module>
      1 #-*- coding: utf-8 -*-
      2 from __future__ import division, print_function, absolute_import
----> 3 from .cbbi import (
      4     is_bbi,
      5     is_bigwig,

ImportError: /home/jg14w/miniconda3/envs/cooler-env/lib/python3.6/site-packages/bbi/cbbi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: TLS_client_method

I tried to work on the [log] (#3 (comment)) like previously:

$ LDFLAGS='-Wl,--no-as-needed' DISTUTILS_DEBUG=1 pip install -v pybbi --log debug.log

It is an environment specific issue, as it did not occur after installing in a different environment

Can you see what happens if you add - openssl to the environment.yml under dependencies:?

Nope, error still there after adding.
I have openssl 1.1.1b installed in miniconda

Hmm... well, that might reflect recent changes on master. What if you replace the git+https://github.com/nvictus/pybbi.git link with just pybbi? Then it should download the package from PyPI.

replaced pybbi-0.2.1.dev0 with pybbi-0.2.0

Uninstalling pybbi-0.2.1.dev0:
  Would remove:
    /home/jg14w/miniconda3/envs/cooler-env/lib/python3.6/site-packages/bbi/*
    /home/jg14w/miniconda3/envs/cooler-env/lib/python3.6/site-packages/pybbi-0.2.1.dev0.dist-info/*
Proceed (y/n)? y
  Successfully uninstalled pybbi-0.2.1.dev0
Collecting pybbi
Requirement already satisfied: six in /home/jg14w/miniconda3/envs/cooler-env/lib/python3.6/site-packages (from pybbi) (1.12.0)
Requirement already satisfied: numpy in /home/jg14w/miniconda3/envs/cooler-env/lib/python3.6/site-packages (from pybbi) (1.16.2)
Installing collected packages: pybbi
Successfully installed pybbi-0.2.0

Started a new node to re-activate the conda environment and opened python notebook:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-607bbd995f76> in <module>
     11 import cooltools
     12 import cooler
---> 13 import bbi
     14 import cython

~/miniconda3/envs/cooler-env/lib/python3.6/site-packages/bbi/__init__.py in <module>
      1 #-*- coding: utf-8 -*-
      2 from __future__ import division, print_function, absolute_import
----> 3 from .cbbi import (
      4     is_bbi,
      5     is_bigwig,

ImportError: /home/jg14w/miniconda3/envs/cooler-env/lib/python3.6/site-packages/bbi/cbbi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: compress

Not sure what's the cause at this point and as much as I would like to understand it, I found a way to work around it, so please don't worry about it..

@gibcus what was your work around? I'm having the same problem...

these are the packages i have installed from the base ubuntu:18.04 docker image

apt install wget less rsync libssl1.0.0 git-lfs build-essential libssl-dev libcurl4-openssl-dev automake gcc libpng-dev

I was able to get this working by installing pybbi before anything else in my conda environment.
I think this makes pybbi link to system installs of packages like openssl/libpng/zlib instead of the conda installs.
here's the install command:
pip install git+https://github.com/nvictus/pybbi.git@0cb6e28#egg=pybbi --no-cache-dir --no-binary :pybbi: --no-deps
(0cb6e28 is the master branch at the time of writing this). Note this does not work if installed from the version in pypi with the same pip arguments.

This seems pretty brittle, but at least it's working for now.

FYI, now that we distribute compiled wheels for linux and mac, it should hopefully no longer be necessary to build from source for Pythons 3.5-8.

Python 2 was dropped, so there should be no need to build from source.