Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

libbz2.so.1.0 cannot open shared object file #11

Closed
simoncchu opened this issue Dec 14, 2018 · 9 comments
Closed

libbz2.so.1.0 cannot open shared object file #11

simoncchu opened this issue Dec 14, 2018 · 9 comments

Comments

@simoncchu
Copy link

I met an issue after finished installing nucleus using command (no error happens):
pip install --user google-nucleus

However, when I try to run the following demo code, I got error:

from nucleus.io import vcf
sf_vcf="test_nist.b37_chr20_100kbp_at_10mb.vcf.gz"
with vcf.VcfReader(sf_vcf) as reader:
    print('Sample names in VCF: ', ' '.join(reader.header.sample_names))

libbz2.so.1.0: cannot open shared object file: No such file or directory

Any suggestion for solving the issue? Thank you!

@ThomasColthurst
Copy link
Contributor

One easy suggestion is to try running the demo code from a different directory. This error can happen if you run the demo from the Nucleus base directory, because then Python tries to load Nucleus from that location rather than from the installed location, and only the installed location has the compiled .so files.

If that doesn't work, you will want to run
$ python

import sys
sys.path
to see where Python is importing Nucleus from. (Since you used --user, the directory name will probably be based in your home directory and will include "site-packages" at the end.)

Once you have that directory, run
$ ls [import dir]/nucleus/io/python

That directory should contain a bunch of .so files like bedgraph_reader.so, gff_writer.so, etc. If it doesn't, there was an installation error.

@simoncchu
Copy link
Author

simoncchu commented Jan 16, 2019

I run outside the installation folder, but still got the error.

run sys.path I got:

['', '/user_path/anaconda2/lib/python27.zip', '/user_path/anaconda2/lib/python2.7', '/user_path/anaconda2/lib/python2.7/plat-linux2', '/user_path/anaconda2/lib/python2.7/lib-tk', '/user_path/anaconda2/lib/python2.7/lib-old', '/user_path/anaconda2/lib/python2.7/lib-dynload', '/user_path/.local/lib/python2.7/site-packages', '/user_path/anaconda2/lib/python2.7/site-packages', '/user_path/anaconda2/lib/python2.7/site-packages/Sphinx-1.5.6-py2.7.egg', '/user_path/anaconda2/lib/python2.7/site-packages/matplotlib_venn-0.11.5-py2.7.egg']

I saw the .so files under /user_path/.local/lib/python2.7/site-packages:

bedgraph_reader.so  bed_writer.so    gff_reader.so            __init__.py                reference.so   unindexed_fasta_reader.so
bedgraph_writer.so  fastq_reader.so  gff_writer.so            __init__.pyc               sam_reader.so  vcf_reader.so
bed_reader.so       fastq_writer.so  indexed_fasta_reader.so  in_memory_fasta_reader.so  sam_writer.so  vcf_writer.so

@pgrosu
Copy link

pgrosu commented Jan 16, 2019

Just update your LD_LIBRARY_PATH and PYTHONPATH environmental variables, and try again.

@simoncchu
Copy link
Author

Sorry @pgrosu, how do I update?

@pgrosu
Copy link

pgrosu commented Jan 16, 2019

Here are a few links describing it for LD_LIBRARY_PATH:

https://www.tecmint.com/understanding-shared-libraries-in-linux/
https://docs.oracle.com/cd/E19455-01/816-0559/chapter2-48927/index.html

The same for PYTHONPATH, which is described here:

https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH

Make sure you echo them out for (i.e. echo $LD_LIBRARY_PATH) to see what they already contain, which you want to keep. You can test changes like this:

LD_LIBRARY_PATH=your_DIR:$LD_LIBRARY_PATH PYTHONPATH=... python Your_Program ...

Basically standard Linux config :)

~p

@simoncchu
Copy link
Author

Problem for me is I don't know where libbz2.so.1.0 is? @pgrosu

@pgrosu
Copy link

pgrosu commented Jan 17, 2019

@ReedWarbler Which linux distribution do you have (i.e. Ubuntu, Redhat, etc)? I can point you to where you can get the package for it from. Alternatively, you can compile it from source, which you can get it from here:

https://sourceforge.net/projects/bzip2/files/

@xyq013563
Copy link

Here are a few links describing it for LD_LIBRARY_PATH:

https://www.tecmint.com/understanding-shared-libraries-in-linux/
https://docs.oracle.com/cd/E19455-01/816-0559/chapter2-48927/index.html

The same for PYTHONPATH, which is described here:

https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH

Make sure you echo them out for (i.e. echo $LD_LIBRARY_PATH) to see what they already contain, which you want to keep. You can test changes like this:

LD_LIBRARY_PATH=your_DIR:$LD_LIBRARY_PATH PYTHONPATH=... python Your_Program ...

Basically standard Linux config :)

~p

Thank you very much! Update the LD_LIBRARY_PATH definitely fixed all of my problems.

@pgrosu
Copy link

pgrosu commented Aug 27, 2019

You're very welcome @xyq013563!
~p

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants