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

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

Open
7 tasks
CocoMlle opened this issue Sep 17, 2021 · 14 comments
Open
7 tasks

Comments

@CocoMlle
Copy link

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 :

  • Search whether this issue (or a similar issue) has been solved before using the search tab above. Link the previous issue if appropriate below.

  • Paste your HiCExplorer version (hicInfo --version) and your python version (python --version) below.

  • Have you checked our documentation on hicexplorer.readthedocs.io?

  • Do you use conda to install HiCExplorer?

  • Do you use the latest HiCExplorer release? If not, please install it via a conda environment:
    conda create --name hicexplorer hicexplorer=3.6 python=3.8 -c bioconda -c conda-forge
    and activate the environment: conda activate hicexplorer. Retry your command. You can exit a conda environment via conda deactivate. To learn more about conda and environments, please consider the following documentation.

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

  • Paste the full HiCExplorer command that produces the issue below
    (ignore if you simply spotted the issue in the code/documentation).

  • Paste the output printed on screen from the command that produces the issue
    below (ignore if you simply spotted the issue in the code/documentation).

@joachimwolff
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

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

  • Delete all the conda environments with HiCExplorer installed
  • Switch to the root environment, run pip uninstall hicexplorer iteratively as long as it finds a version
  • Run whereis hicInfo: take the path, sth like /home/user/miniconda3/envs/hicexplorer_py38/bin/hicInfo and delete the following: rm -rf /home/user/miniconda3/envs/hicexplorer_py38/bin/hic* and rm -rf /home/user/miniconda3/envs/hicexplorer_py38/bin/chic*
  • Run hicInfo and see if it is still available. If yes, try to find out why and delete it.
  • If all occurrences of HiCExplorer are deleted we can try it again to install it: conda create --name hicexplorer hicexplorer=3.7.1. python=3.8 -c bioconda -c conda-forge

I hope this resolves your issues.

@CocoMlle
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

joachimwolff commented Sep 30, 2021

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
Copy link

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
Copy link
Collaborator

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
Copy link
Collaborator

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 of which 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
Copy link

yermekaitenov commented Mar 14, 2023

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
Copy link
Collaborator

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
Copy link

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
Copy link
Collaborator

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.

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

5 participants