openvax / pyensembl

Python interface to access reference genome features (such as genes, transcripts, and exons) from Ensembl
Apache License 2.0
374 stars 65 forks source link

exception running basic pyensembl install command #200

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello

I'm just getting started using pyensembl and I'm unable to run the initial install command: pyensembl install --release 87 --species human

Any advice etc. on getting this working much appreciated, more details below.

I get the following output / stacktrace:

2018-06-27 11:44:32,747 - pyensembl.shell - INFO - Running 'install' for EnsemblRelease(release=87, species='homo_sapiens')
2018-06-27 11:44:32,748 - pyensembl.download_cache - INFO - Fetching /Users/davelahr/pyensembl/pyensembl/GRCh38/ensembl87/Homo_sapiens.GRCh38.87.gtf.gz from URL ftp://ftp.ensembl.org/pub/release-87/gtf/homo_sapiens/Homo_sapiens.GRCh38.87.gtf.gz
Traceback (most recent call last):
  File "/Users/davelahr/miniconda2/envs/pyensembl/bin/pyensembl", line 11, in <module>
    sys.exit(run())
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/shell.py", line 169, in run
    genome.download(overwrite=args.overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/genome.py", line 235, in download
    self._set_local_paths(download_if_missing=True, overwrite=overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/genome.py", line 216, in _set_local_paths
    overwrite=overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/genome.py", line 180, in _get_gtf_path
    overwrite=overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/genome.py", line 173, in _get_cached_path
    overwrite=overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/download_cache.py", line 295, in local_path_or_install_error
    overwrite=overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/download_cache.py", line 270, in download_or_copy_if_necessary
    overwrite)
  File "/Users/davelahr/miniconda2/envs/pyensembl/lib/python3.6/site-packages/pyensembl/download_cache.py", line 218, in _download_if_necessary
    download_url=url)
TypeError: _download() got an unexpected keyword argument 'filename'

My setup:

  1. created an environment using miniconda with pip
    • python version 3.6.5
  2. pip install pyensembl - version 1.2.6
    • final line of output: Successfully installed appdirs-1.4.3 chardet-3.0.4 datacache-1.0.0 gtfparse-1.0.7 idna-2.7 memoized-property-1.0.3 mock-2.0.0 numpy-1.14.5 pandas-0.23.1 pbr-4.0.4 progressbar33-2.4 pyensembl-1.2.6 python-dateutil-2.7.3 pytz-2018.4 requests-2.19.1 serializable-0.1.1 simplejson-3.15.0 six-1.11.0 tinytimer-0.0.0 typechecks-0.1.0 urllib3-1.23
ai4pharma commented 6 years ago

I have the same problem. It seems caused by line 218 of pyensembl/download_cache.py, which is

            datacache.download._download(
                filename=local_filename,
                full_path=cached_path,
                download_url=url)

However, when I check datacache/download.py, the _download function is

def _download(download_url, timeout=None):
    if download_url.startswith("http"):
        response = requests.get(download_url, timeout=timeout)
        response.raise_for_status()
        return response.content

It only require download_url, does't require filename and full_path argument

bbreton commented 6 years ago

I believe manually downgrading datacache to 0.5.5 from 1.0.0 will fix this issue until the devs get a chance to fix it. Hopefully doing this doesn't cause problems elsewhere as I didn't run full testing on it.

pip install --upgrade datacache==0.5.5

ghost commented 6 years ago

Thank you, that worked for me!

iskandr commented 6 years ago

Sorry for the breakage @bbreton and @dllahr-foghorntx! A PR got stuck because of https://github.com/openvax/pyensembl/issues/201. I just merged the necessary PR to fix the install command and will work on figuring out Travis later.

samleenz commented 6 years ago

Hi @iskandr, I still have this issue using the bioconda install of pyensembl v=1.2.6 for python 3.6. When I look at the download_cache.py file I see the fix from #191 is not present (lines 214-218). Do you know when the conda version will be updated to fix this?

iskandr commented 6 years ago

Hey @samleenz -- we currently only auto-submit new PyEnsembl version to PyPI so the conda versions are likely being maintained by someone else (e.g. https://anaconda.org/edurand/pyensembl). I can look into adding support for conda.

samleenz commented 6 years ago

Ah, didn't notice that - apologies! If you do end up adding pyensembl to conda that would be very appreciated but if not i can make the pip version work.