grp-bork / gunc

Python package for detection of chimerism and contamination in prokaryotic genomes.
GNU General Public License v3.0
66 stars 8 forks source link

Error downloading DB #7

Closed michoug closed 3 years ago

michoug commented 3 years ago

Hi, using the pip installation inside a new conda env and version 1.0.1, I got this error while running the command : gunc download_db ./

[START] 19:17:04 2021-01-06
[INFO] DB downloading...
Traceback (most recent call last):
  File "/home/michoug/miniconda3/envs/gunc/bin/gunc", line 10, in <module>
    sys.exit(main())
  File "/home/michoug/miniconda3/envs/gunc/lib/python3.6/site-packages/gunc/gunc.py", line 520, in main
    gunc_database.get_db(args.path)
  File "/home/michoug/miniconda3/envs/gunc/lib/python3.6/site-packages/gunc/gunc_database.py", line 104, in get_db
    download_file(gz_file_url, gz_file_path)
  File "/home/michoug/miniconda3/envs/gunc/lib/python3.6/site-packages/gunc/gunc_database.py", line 38, in download_file
    with requests.get(file_url, stream=True) as r:
AttributeError: __enter_
fullama commented 3 years ago

I wonder could it be that you have an older version of requests? If this is the case I could specify a min version for the next release..

Could you maybe post the output of pip freeze?

Is there a reason you didn't conda install it if you are already using a conda env?

michoug commented 3 years ago

Here is the ouptut of pip freeze

certifi==2020.12.5
checkm-genome==1.1.3
cycler==0.10.0
DendroPy==4.5.1
gunc @ file:///opt/conda/conda-bld/gunc_1608301038107/work
kiwisolver==1.3.1
matplotlib==3.3.3
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1609880971888/work
pandas==1.1.5
Pillow==8.1.0
plotly @ file:///home/conda/feedstock_root/build_artifacts/plotly_1607525005664/work
pyparsing==2.4.7
pysam==0.16.0.1
python-dateutil==2.8.1
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1608904108784/work
requests==2.13.0
retrying==1.3.3
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy_1604304777848/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1590081179328/work

I upgraded requests to the latest version (v2.25.1) and it seems to work now

fullama commented 3 years ago

Fantastic.. glad we could sort this one out quickly 😃

I'll add it to the requirements for future versions so pip will not allowed older versions of requests.

Thanks for letting me know about this.. it helps a lot..

tamascogustavo commented 1 month ago

The erros still persistis in conda recipe.

gunc download_db ./testes/
[START] 11:24:10 2024-09-03
[INFO] DB downloading...
Traceback (most recent call last):
  File "/home/gustavotamasco/anaconda3/envs/gunc/bin/gunc", line 10, in <module>
    sys.exit(main())
  File "/home/gustavotamasco/anaconda3/envs/gunc/lib/python3.6/site-packages/gunc/gunc.py", line 561, in main
    gunc_database.get_db(args.path, args.database)
  File "/home/gustavotamasco/anaconda3/envs/gunc/lib/python3.6/site-packages/gunc/gunc_database.py", line 108, in get_db
    download_file(gz_file_url, gz_file_path)
  File "/home/gustavotamasco/anaconda3/envs/gunc/lib/python3.6/site-packages/gunc/gunc_database.py", line 38, in download_file
    with requests.get(file_url, stream=True) as r:
AttributeError: __enter__

By uninstalling and reinstalling gunc via pip and also prodigal and diamond via conda, I managed to make it work. There is something wrong with the conda pkg.