Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named HiCMatrix #21

Open
ddelgadillod opened this issue Mar 29, 2021 · 2 comments
Open

ImportError: No module named HiCMatrix #21

ddelgadillod opened this issue Mar 29, 2021 · 2 comments

Comments

@ddelgadillod
Copy link

ddelgadillod commented Mar 29, 2021

Hi

I tried to run HiC Assembler over conda environment with Python 2.7 and an old version of some packages as hicexplorer v2.2 and biopython v1.76 (last supported for Python 2.7), when I tried to execute assemble command, It doesn't can import hicexplorer.HiCMatrix

(HiCAssemblerPy27) ddelgadillo@COMOSPLNXU09:~/Software$ assemble
Traceback (most recent call last):
  File "/home/ddelgadillo/miniconda3/envs/HiCAssemblerPy27/bin/assemble", line 11, in <module>
    import hicassembler.HiCAssembler as HiCAssembler
  File "/home/ddelgadillo/miniconda3/envs/HiCAssemblerPy27/lib/python2.7/site-packages/hicassembler/HiCAssembler.py", line 8, in <module>
    import hicexplorer.HiCMatrix as HiCMatrix
ImportError: No module named HiCMatrix

I check hicexplorer and everything looks well, Its it another dependency or hicexplorer complement that I forget to install?

I appreciate so much your help

Diego D

@ostueker
Copy link

I ran into the same issue today. It seems that import hicexplorer.HiCMatrix as HiCMatrix should be changed to import hicmatrix.HiCMatrix as HiCMatrix.

In the checked out repository one can easily find all of the imports with:

$ git grep "import hicexplorer.HiCMatrix"
hicassembler/HiCAssembler.py:import hicexplorer.HiCMatrix as HiCMatrix
hicassembler/Scaffolds.py:import hicexplorer.HiCMatrix as HiCMatrix
hicassembler/plotScaffoldInteractive.py:import hicexplorer.HiCMatrix as HiCMatrix
hicassembler/plotScaffoldsHiC.py:import hicexplorer.HiCMatrix as HiCMatrix
hicassembler/test/test_Scaffolds.py:import hicexplorer.HiCMatrix as HiCMatrix

and change the imports with:

sed -i  's/import hicexplorer.HiCMatrix/import hicmatrix.HiCMatrix/' hicassembler/*py hicassembler/test/*.py

Would be nice if the devs would provide a new release that fixes this issue.

@pgonzale60
Copy link

pgonzale60 commented May 24, 2021

Another way of avoiding that error is by trying recreating an environment with the versions they used in their last release. This worked for me just now.
conda create -n hicex -c bioconda -c conda-forge 'hicexplorer==2.1.1' 'python=2.7' 'pytest=2.9' 'versioneer=0.18' 'networkx=2.2' 'future=0.16' 'six=1.10' 'pandas=0.20' 'pysam=0.11'

With this the dependencies will be satisfied. To avoid upgrading to incompatible ones, empty the 'requirements.txt' file. After that you can safely install with pip.

conda activate hicex
cd HiCAssembler
echo "" > requirements.txt
sed -i "s/'\*.txt'/['requirements.txt']/" setup.py
pip install -e .

This was referenced Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants