diff --git a/alphastats/loader/BaseLoader.py b/alphastats/loader/BaseLoader.py index e94138d2..97d7d765 100644 --- a/alphastats/loader/BaseLoader.py +++ b/alphastats/loader/BaseLoader.py @@ -3,9 +3,16 @@ import os import numpy as np from alphastats.utils import find_duplicates_in_list -import pkg_resources from typing import Union +import sys + +if sys.version_info >= (3, 9): + import importlib.resources as importlib_resources +else: + # TODO drop this together with support for python 3.8 + import importlib_resources + class BaseLoader: """Parent class of Loaders""" @@ -74,8 +81,8 @@ def _check_if_file_exists(self, file): def _add_contamination_column(self): #  load df with potential contamination from fasta file - contaminations_path = pkg_resources.resource_filename( - __name__, "../data/contaminations.txt" + contaminations_path = ( + importlib_resources.files(__name__) / "../data/contaminations.txt" ) contaminations = pd.read_csv(contaminations_path, sep="\t") contaminations_ids = contaminations["Uniprot ID"].to_list() diff --git a/release/pyinstaller/alphastats.spec b/release/pyinstaller/alphastats.spec index d0b43af1..55faff7c 100644 --- a/release/pyinstaller/alphastats.spec +++ b/release/pyinstaller/alphastats.spec @@ -5,7 +5,6 @@ import os import sys from PyInstaller.building.build_main import Analysis, PYZ, EXE, COLLECT, BUNDLE, TOC import PyInstaller.utils.hooks -import pkg_resources import importlib.metadata import alphastats from PyInstaller.utils.hooks import collect_submodules