slamdunk icon indicating copy to clipboard operation
slamdunk copied to clipboard

slamdunk installation fails: Library not loaded: @rpath/libhts.2.dylib

Open drowsygoat opened this issue 4 years ago • 9 comments

Hi, I was trying to install slamdunk, first, using pip install, and then using conda. In case of conda, I could not get past the following error:

(slam2) ➜  ts slamdunk map -r GRCm38.primary_assembly.genome.fa -o results -5 0 -t 1 all__BC_SL3_EtOH_Frozen_mock.fq
Traceback (most recent call last):
  File "/opt/anaconda3/envs/slam2/bin/slamdunk", line 6, in <module>
    from slamdunk.slamdunk import run
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/slamdunk/slamdunk.py", line 34, in <module>
    from slamdunk.dunks import tcounter, mapper, filter, deduplicator, snps
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/slamdunk/dunks/tcounter.py", line 23, in <module>
    import pysam
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/pysam/__init__.py", line 5, in <module>
    from pysam.libchtslib import *
ImportError: dlopen(/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/pysam/libchtslib.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libhts.2.dylib
  Referenced from: /opt/anaconda3/envs/slam2/lib/python3.6/site-packages/pysam/libchtslib.cpython-36m-darwin.so
  Reason: image not found

In case of using pip, it seems that I had a similar issue as the one described in this thread: https://github.com/t-neumann/slamdunk/issues/29, the map module could not find ngm:

➜ ts slamdunk map -r GRCm38.primary_assembly.genome.fa -o results -5 0 -t 1 all__BC_SL3_EtOH_Frozen_mock.fq Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/slamdunk", line 11, in <module> load_entry_point('slamdunk==0.4.3', 'console_scripts', 'slamdunk')() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slamdunk/slamdunk.py", line 441, in run mapper.checkNextGenMapVersion() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slamdunk/dunks/mapper.py", line 43, in checkNextGenMapVersion raise RuntimeError('Could not get NextGenMap version. Please reinstall slamdunk package.') RuntimeError: Could not get NextGenMap version. Please reinstall slamdunk package.

I feel I am close to having it working, but I am missing this last touch. I will very much appreciate your help.

Lech

drowsygoat avatar Feb 03 '21 20:02 drowsygoat

Hi - how exactly did you create the conda environment and which system are you using. MacOS?

t-neumann avatar Feb 04 '21 19:02 t-neumann

Hi Tobias, It is MacOS Catalina. Env was created like that: conda create --name slam2 -c bioconda slamdunk but using conda install -c bioconda/label/cf201901 slamdunk let do the same problem. I managed to install using pip3, but then the second problem [...]Could not get NextGenMap version.[...] occured.

drowsygoat avatar Feb 05 '21 20:02 drowsygoat

Hi @drowsygoat what about if you use a plain

conda create --name slam2 slamdunk

so not force it to come from the bioconda channel?

t-neumann avatar Feb 05 '21 21:02 t-neumann

Hi @t-neumann, I just did, same problem:

Traceback (most recent call last):
  File "/opt/anaconda3/envs/slam2/bin/slamdunk", line 6, in <module>
    from slamdunk.slamdunk import run
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/slamdunk/slamdunk.py", line 34, in <module>
    from slamdunk.dunks import tcounter, mapper, filter, deduplicator, snps
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/slamdunk/dunks/tcounter.py", line 23, in <module>
    import pysam
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/pysam/__init__.py", line 5, in <module>
    from pysam.libchtslib import *
ImportError: dlopen(/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/pysam/libchtslib.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libhts.2.dylib
  Referenced from: /opt/anaconda3/envs/slam2/lib/python3.6/site-packages/pysam/libchtslib.cpython-36m-darwin.so
  Reason: image not found

I also tried to address the problem like this:

(slam2) ➜  ts conda install -c conda-forge -c bioconda libdeflate=1.0
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /opt/anaconda3/envs/slam2

  added / updated specs:
    - libdeflate=1.0


The following packages will be SUPERSEDED by a higher-priority channel:

  libdeflate         conda-forge::libdeflate-1.7-h35c211d_5 --> bioconda::libdeflate-1.0-h1de35cc_1

The following packages will be DOWNGRADED:

  bcftools                                  1.11-he8d9d6d_0 --> 1.9-h3a161e8_4
  htslib                                    1.11-h422799e_2 --> 1.9-h3a161e8_7
  samtools                                  1.11-h725deca_0 --> 1.7-1
  slamdunk                                       0.4.3-py_0 --> 0.4.0-py_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

but this happened:

(slam2) ➜  ts slamdunk --version
slamdunk 0.4.0
(slam2) ➜  ts slamdunk map -r GRCm38.primary_assembly.genome.fa -o results -5 0 -t 1 all__BC_SL3_EtOH_Frozen_mock.fq
Traceback (most recent call last):
  File "/opt/anaconda3/envs/slam2/bin/slamdunk", line 10, in <module>
    sys.exit(run())
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/slamdunk/slamdunk.py", line 414, in run
    mapper.checkNextGenMapVersion()
  File "/opt/anaconda3/envs/slam2/lib/python3.6/site-packages/slamdunk/dunks/mapper.py", line 37, in checkNextGenMapVersion
    matchObj = re.match( r'.*([0-9]+\.[0-9]+\.[0-9]+).*', ngmHelp, re.M|re.I)
  File "/opt/anaconda3/envs/slam2/lib/python3.6/re.py", line 172, in match
    return _compile(pattern, flags).match(string)
TypeError: cannot use a string pattern on a bytes-like object

drowsygoat avatar Feb 06 '21 08:02 drowsygoat

Hm does anything speak against using Docker?

t-neumann avatar Feb 07 '21 11:02 t-neumann

I had the same problem and I solved it by updating pysam to the latest version 0.16.0.1 using "conda install pysam=0.16.0.1"

MarcoDiS avatar Feb 17 '21 13:02 MarcoDiS

Thanks @MarcoDiS , will try it. @t-neumann, Docker works, but I have the feeling it's less efficient with hardware resources for large (mapping) jobs.

drowsygoat avatar Feb 17 '21 21:02 drowsygoat

@drowsygoat Hm if that is the case, did you make sure you specify the proper resources during docker run?

Like --cpus 2 -m 8g . Also, did you check your Docker resource settings in the Mac.app allow using these resources?

image

t-neumann avatar Feb 18 '21 18:02 t-neumann

The problem here is likely not correctly prioritizing conda-forge channel (dynamic library errors usually arise from improper channel mixing). Any ad hoc use of Bioconda channel should take the form:

conda install -c conda-forge -c bioconda <pkg>

In this case, use

conda create -n slam2 -c conda-forge -c bioconda slamdunk

Generally, Bioconda recommends setting up channels globally.

mfansler avatar Feb 27 '23 01:02 mfansler