PayneLab/cptac

KeyError: 'filesize' on cptac import

Closed this issue · 3 comments

Hi,
I 'm getting an error when importing cptac(1.5.6)

When i import cptac(1.5.5), 'filename' ERROR happened same as issue#50. So I use the newly updated version try to avoid it.
Now it goes as below:

Traceback (most recent call last):
  File ".../cptac-1.5.6-py3.9.egg/cptac/tools/download_tools.py",                                                                                                                                                            line 60, in init_files
    get_data("https://zenodo.org/api/records/8394329/files/cptac_genes.csv/content", acetyl_mapping_path)
  File ".../cptac/tools/download_tools.py",                                                                                                                                                            line 167, in get_data
    file_size = repo_data['files'][num]['filesize']
KeyError: 'filesize'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File ".../cptac/__init__.py", line 65, in                                                                                                                                                            <module>
    init_files()
  File ".../cptac/tools/download_tools.py",                                                                                                                                                            line 68, in init_files
    raise CptacError(f"ERROR: {e}")
cptac.exceptions.CptacError: ERROR: 'filesize'

Thanks for your help in advance.

sabmel commented

I just pushed the new release on PyPi. Please let me know if the issue persists.

I just pushed the new release on PyPi. Please let me know if the issue persists.

I've tried it ,use pip install cptac==1.5.6,still got the same error when importing.

Same issue here, I also installed the latest version, 1.5.6, by using pip install cptac==1.5.6, but got the same
filesize error.

Looking in indexes: https://pypi.org/simple, https://pip.modernatx.net/
Collecting cptac==1.5.6
  Downloading cptac-1.5.6-py3-none-any.whl (5.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.5/5.5 MB 31.8 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: pyranges>=0.0.111 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (0.0.129)
Requirement already satisfied: scipy>=1.10.0 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (1.10.0)
Requirement already satisfied: numpy>=1.16.3 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (1.23.5)
Requirement already satisfied: tqdm>=4.65.0 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (4.66.1)
Requirement already satisfied: statsmodels>=0.10.0 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (0.13.5)
Requirement already satisfied: openpyxl>=2.6.0 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (3.0.10)
Requirement already satisfied: pandas>=2.0.0 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (2.1.2)
Requirement already satisfied: requests>=2.21.0 in /opt/install/conda/lib/python3.10/site-packages (from cptac==1.5.6) (2.28.1)
Requirement already satisfied: et_xmlfile in /opt/install/conda/lib/python3.10/site-packages (from openpyxl>=2.6.0->cptac==1.5.6) (1.0.1)
Requirement already satisfied: python-dateutil>=2.8.2 in /opt/install/conda/lib/python3.10/site-packages (from pandas>=2.0.0->cptac==1.5.6) (2.8.2)
Requirement already satisfied: tzdata>=2022.1 in /opt/install/conda/lib/python3.10/site-packages (from pandas>=2.0.0->cptac==1.5.6) (2023.3)
Requirement already satisfied: pytz>=2020.1 in /opt/install/conda/lib/python3.10/site-packages (from pandas>=2.0.0->cptac==1.5.6) (2022.7.1)
Requirement already satisfied: natsort in /opt/install/conda/lib/python3.10/site-packages (from pyranges>=0.0.111->cptac==1.5.6) (8.2.0)
Requirement already satisfied: ncls>=0.0.63 in /opt/install/conda/lib/python3.10/site-packages (from pyranges>=0.0.111->cptac==1.5.6) (0.0.68)
Requirement already satisfied: sorted-nearest>=0.0.33 in /opt/install/conda/lib/python3.10/site-packages (from pyranges>=0.0.111->cptac==1.5.6) (0.0.39)
Requirement already satisfied: tabulate in /opt/install/conda/lib/python3.10/site-packages (from pyranges>=0.0.111->cptac==1.5.6) (0.9.0)
Requirement already satisfied: charset-normalizer<3,>=2 in /opt/install/conda/lib/python3.10/site-packages (from requests>=2.21.0->cptac==1.5.6) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /opt/install/conda/lib/python3.10/site-packages (from requests>=2.21.0->cptac==1.5.6) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in /opt/install/conda/lib/python3.10/site-packages (from requests>=2.21.0->cptac==1.5.6) (2022.12.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/install/conda/lib/python3.10/site-packages (from requests>=2.21.0->cptac==1.5.6) (1.26.13)
Requirement already satisfied: packaging>=21.3 in /opt/install/conda/lib/python3.10/site-packages (from statsmodels>=0.10.0->cptac==1.5.6) (23.0)
Requirement already satisfied: patsy>=0.5.2 in /opt/install/conda/lib/python3.10/site-packages (from statsmodels>=0.10.0->cptac==1.5.6) (0.5.3)
Requirement already satisfied: six in /opt/install/conda/lib/python3.10/site-packages (from patsy>=0.5.2->statsmodels>=0.10.0->cptac==1.5.6) (1.16.0)
Installing collected packages: cptac
  Attempting uninstall: cptac
    Found existing installation: cptac 1.5.5
    Uninstalling cptac-1.5.5:
      Successfully uninstalled cptac-1.5.5
Successfully installed cptac-1.5.6
Note: you may need to restart the kernel to use updated packages.
KeyError                                  Traceback (most recent call last)
File /opt/install/conda/lib/python3.10/site-packages/cptac/tools/download_tools.py:60, in init_files()
     59         if BUCKET[num]['key'] == 'cptac_genes.csv':
---> 60             get_data("https://zenodo.org/api/records/8394329/files/cptac_genes.csv/content", acetyl_mapping_path)
     61 if not os.path.isfile(brca_mapping_path):

File /opt/install/conda/lib/python3.10/site-packages/cptac/tools/download_tools.py:167, in get_data(url, subfolder, num_threads)
    166 if repo_data['files'][num]['key'] == file_name:
--> 167     file_size = repo_data['files'][num]['filesize']
    168     break

KeyError: 'filesize'

During handling of the above exception, another exception occurred:

CptacError                                Traceback (most recent call last)
Cell In[1], line 1
----> 1 import cptac
      2 import cptac.utils as ut
      3 import matplotlib.pyplot as plt

File /opt/install/conda/lib/python3.10/site-packages/cptac/__init__.py:65
     63 #### Create the index for the data files (file lookup table)
     64 try:
---> 65     init_files()
     66 except NoInternetError:
     67     if path.exists(path.join(CPTAC_BASE_DIR, 'data', 'index.tsv')):

File /opt/install/conda/lib/python3.10/site-packages/cptac/tools/download_tools.py:68, in init_files()
     66     raise HttpResponseError(f"Requesting data failed with the following error: {e}")
     67 except Exception as e:
---> 68     raise CptacError(f"ERROR: {e}")

CptacError: ERROR: 'filesize'`