khmer icon indicating copy to clipboard operation
khmer copied to clipboard

Having issues with AttributeError: ZipFile(path) as file

Open xsharkbaitx opened this issue 7 years ago • 3 comments

I'm trying to get extract-paired-reads.py to work and am having the following issue: Traceback (most recent call last): File "/usr/bin/extract-paired-reads.py", line 4, in import pkg_resources File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 3147, in @_call_aside File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 3131, in _call_aside f(*args, **kwargs) File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 3160, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 657, in _build_master ws = cls() File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 650, in init self.add_entry(entry) File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 706, in add_entry for dist in find_distributions(entry, True): File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 1966, in find_eggs_in_zip if metadata.has_metadata('PKG-INFO'): File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 1488, in has_metadata return self.egg_info and self._has(self._fn(self.egg_info, name)) File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 1840, in _has return zip_path in self.zipinfo or zip_path in self._index() File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 1717, in zipinfo return self._zip_manifests.load(self.loader.archive) File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 1677, in load manifest = self.build(path) File "/usr/lib/python2.6/site-packages/pkg_resources/init.py", line 1650, in build with zipfile.ZipFile(path) as zfile: AttributeError: ZipFile instance has no attribute 'exit'

We are running python 2.7.6 on our server and the input files are trimmed, qc'd, fasta files. Thanks in advance.

xsharkbaitx avatar Feb 20 '18 00:02 xsharkbaitx

Hi, thanks for the report. It looks like it's almost certainly a conflict between different versions of Python on your system. You say Python 2.7.6 is installed, yet all the file paths in the stack trace point to modules in a Python 2.6 installation. Also, if you're using a recent version of khmer installed directly from Github, Python 2.7 is no longer supported and you'll need to upgrade to Python 3 in order to use khmer.

If you have admin privileges on the server, you should be able to follow the following installation instructions. If not, I would suggest installing the Anaconda Python distribution in your server's home directory and installing khmer in a conda virtual environment (instructions included in the link above).

standage avatar Feb 20 '18 17:02 standage

Thanks for the feedback on the issue.

xsharkbaitx avatar Feb 22 '18 00:02 xsharkbaitx

Did this resolve your issues @xsharkbaitx?

standage avatar Mar 13 '18 05:03 standage