deeptools / HiCExplorer

HiCExplorer is a powerful and easy to use set of tools to process, normalize and visualize Hi-C data.
https://hicexplorer.readthedocs.org
GNU General Public License v3.0
231 stars 70 forks source link

hicBuildMatrix : ImportError: Bio.Alphabet has been removed from Biopython. #755

Open CocoMlle opened 3 years ago

CocoMlle commented 3 years ago

Hi ! i know this issue supposed to be solved but it seems not. i tried install and run hicexplorer in two ways (with git and conda), in all situation i have the same error while trying to run hicBuildMatrix.

for conda installation : conda create --name hicexplorer hicexplorer=3.6 python=3.8 -c bioconda -c conda-forge

(hicexplorer) ma5840be@krenek02:conda list | grep hicexplorer

packages in environment at /work/gad/shared/bin/miniconda3/envs/hicexplorer:

hicexplorer 3.6 (hicexplorer) ma5840be@krenek02:conda list | grep biopython
biopython 1.76 py36h516909a_0 conda-forge

python : 3.6 i'm running it on a cge server. i installed it as you said and paid attention about biopython version (<1.77) wich is ok but still it's not working. exact same issue with the git install. thanks for your help !

Marine

Welcome to the HiCExplorer GitHub repository! Before opening the issue please check that the following requirements are met :

Retry your command, is it solved now? If not please continue with the following:

joachimwolff commented 3 years ago

Would it be an option for you to try the latest HiCExplorer version 3.7 or if the 3.6 version is important to you; try to use Python version 3.7 or 3.6?

CocoMlle commented 3 years ago

thanks for your answer ! i already tried with python 3.6 as it's the current version on the server but i have the same error. i can try the latest version. Is it on conda repository ?

CocoMlle commented 3 years ago

is the lastest version in git repo ? because even for this one nothing it's working. For restsite i have this error with git repo : ma5840be@krenek02:./hicFindRestSite Traceback (most recent call last): File "./hicFindRestSite", line 4, in from hicexplorer.hicFindRestSite import main ModuleNotFoundError: No module named 'hicexplorer.hicFindRestSite'

and this one with conda : ma5840be@krenek02:hicFindRestSite Traceback (most recent call last): File "/work/gad/shared/bin/miniconda3/bin/hicFindRestSite", line 4, in from hicexplorer.hicFindRestSite import main ModuleNotFoundError: No module named 'hicexplorer.hicFindRestSite' (reverse-i-search)`conda': /work/gad/shared/bin/mini^Cnda2/bin/bin/

then i assumed all the installation is corrupted for some unknown reason

joachimwolff commented 3 years ago

I see. I think there is a major issue in your software environment, that happens sometimes. Let's try to clean it:

I hope this resolves your issues.

CocoMlle commented 3 years ago

ok thanks a lot i will try that. just one question, do you think it can work with python 3.6 ? because it's the only version installed on the server and upgrade python is challenging

CocoMlle commented 3 years ago

unfortunatly the error remains after re installing everything

(hicexplorer) ma5840be@krenek03:findRestSite Traceback (most recent call last): File "/work/gad/shared/bin/miniconda3/bin/findRestSite", line 4, in from hicexplorer.findRestSite import main File "/work/gad/shared/bin/miniconda3/lib/python3.6/site-packages/hicexplorer/findRestSite.py", line 11, in from Bio.Alphabet import generic_dna File "/work/gad/shared/bin/miniconda3/lib/python3.6/site-packages/Bio/Alphabet/init.py", line 21, in "Bio.Alphabet has been removed from Biopython. In many cases, the alphabet can simply be ignored and removed from scripts. In a few cases, you may need to specify the molecule_type as an annotation on a SeqRecord for your script to work correctly. Please see https://biopython.org/wiki/Alphabet for more information." ImportError: Bio.Alphabet has been removed from Biopython. In many cases, the alphabet can simply be ignored and removed from scripts. In a few cases, you may need to specify the molecule_type as an annotation on a SeqRecord for your script to work correctly. Please see https://biopython.org/wiki/Alphabet for more information. (hicexplorer) ma5840be@krenek03:conda list | grep biopython biopython 1.76 py36h516909a_0 conda-forge (hicexplorer) ma5840be@krenek03:conda list | grep hicexplorer

packages in environment at /work/gad/shared/bin/miniconda3/envs/hicexplorer:

hicexplorer 3.7.1 pyhdfd78af_0 bioconda

i wasn't able to use python 3.8 as it's not installed on the server then i did it with python 3.6. maybe it's related to that?

joachimwolff commented 2 years ago

i wasn't able to use python 3.8 as it's not installed on the server then i did it with python 3.6. maybe it's related to that?

You can specify in a conda environment a python version that is different from the version installed on your server. Please consider again the command I wrote for you: conda create --name hicexplorer hicexplorer=3.7.1. python=3.8 -c bioconda -c conda-forge

Nadolina commented 2 years ago

Hi all, I also had an Import Error because the two most recent version of biopython do not contain Bio.Alphabet. I was able to resolve the issue by installing biopython 1.77, but obviously I'd prefer to have the latest versions. Going forward this would be an issue for me as well as other hicexplorer users as well. Will there be a solution to this?

joachimwolff commented 2 years ago

Haven't we fixed this and can use also > 1.77 of Biopython @LeilyR @lldelisle ? Or was there maybe some dependency somewhere... I will check these days if I find some time.

lldelisle commented 2 years ago

Hi, Sorry for the late answer. @CocoMlle @Nadolina do you still have this issue? If yes, please explain how you installed HiCExplorer. Copy paste the full log of error you get (please use a code block surrounding the output by ``). In addition, copy paste the output ofwhich findRestSite`. From what I see in @CocoMlle logs:

(hicexplorer) ma5840be@krenek03:findRestSite Traceback (most recent call last): File "/work/gad/shared/bin/miniconda3/bin/findRestSite", line 4, in

There is a HiCExplorer installed in /work/gad/shared/bin/miniconda3 instead of /work/gad/shared/bin/miniconda3/envs/hicexplorer.

yermekaitenov commented 1 year ago

Hello, everyone. I am having a similar issue here: even simple entering hicBuildMatrix gives an error below. I tried deleting the environment and creating a new one, with different python versions 3.7, 3.10.5, but it didn't help. This is a recent error for me, because in the past I was able to run my analysis using the same hicExplorer 3.7.2. Any help would be appreciated.

Traceback (most recent call last): File "/home/yermek/anaconda3/envs/hic/bin/hicBuildMatrix", line 4, in from hicexplorer.hicBuildMatrix import main File "/home/yermek/anaconda3/envs/hic/lib/python3.7/site-packages/hicexplorer/hicBuildMatrix.py", line 23, in from Bio.Alphabet import generic_dna File "/home/yermek/anaconda3/envs/hic/lib/python3.7/site-packages/Bio/Alphabet/init.py", line 21, in "Bio.Alphabet has been removed from Biopython. In many cases, the alphabet can simply be ignored and removed from scripts. In a few cases, you may need to specify the molecule_type as an annotation on a SeqRecord for your script to work correctly. Please see https://biopython.org/wiki/Alphabet for more information." ImportError: Bio.Alphabet has been removed from Biopython. In many cases, the alphabet can simply be ignored and removed from scripts. In a few cases, you may need to specify the molecule_type as an annotation on a SeqRecord for your script to work correctly. Please see https://biopython.org/wiki/Alphabet for more information.

lldelisle commented 1 year ago

It seems that you are not using the last version of hicexplorer. Can you try hicBuildMatrix--version as well as conda list | grep hicexplorer? Thank you

yermekaitenov commented 1 year ago

Hello, @lldelisle Thanks. I am copy&pasting the requested error message below. Meanwhile, I installed hicExplorer in a fresh environment running on Python 3.9.15 and it seems to be working nicely now. As I said before, Python versions 3.7, 3.10.5 did not work for me for some reason...

hicBuildMatrix --version Traceback (most recent call last): File "/data/miniconda3/envs/yaitenov/bin/hicBuildMatrix", line 4, in from hicexplorer.hicBuildMatrix import main File "/data/miniconda3/envs/yaitenov/lib/python3.10/site-packages/hicexplorer/hicBuildMatrix.py", line 26, in from hicmatrix import HiCMatrix as hm File "/data/miniconda3/envs/yaitenov/lib/python3.10/site-packages/hicmatrix/HiCMatrix.py", line 14, in import cooler File "/data/miniconda3/envs/yaitenov/lib/python3.10/site-packages/cooler/init.py", line 14, in from .api import Cooler, annotate File "/data/miniconda3/envs/yaitenov/lib/python3.10/site-packages/cooler/api.py", line 22, in from .util import parse_cooler_uri, parse_region, open_hdf5, closing_hdf5 File "/data/miniconda3/envs/yaitenov/lib/python3.10/site-packages/cooler/util.py", line 690, in columns, dtype=None, index_columns=None, index_names=None, default_dtype=np.object File "/data/miniconda3/envs/yaitenov/lib/python3.10/site-packages/numpy/init.py", line 305, in getattr raise AttributeError(__former_attrs_[attr]) AttributeError: module 'numpy' has no attribute 'object'. np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'object'? conda list | grep hicexplorer hicexplorer 3.7.2 pyhdfd78af_1 bioconda

It seems that you are not using the last version of hicexplorer. Can you try hicBuildMatrix--version as well as conda list | grep hicexplorer? Thank you

lldelisle commented 1 year ago

I think it did not work in 3.10 for a different reason (cooler vs numpy versions compatibilities). If you want to make it work in 3.10, just use upgrade cooler to >=0.9.0. I am closing the issue but if you wanted to make it work in 3.7, feel free to reopen it with the results of the same command lines in a conda environment with python 3.7.