Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'staramr' #142

Closed
neelam19051 opened this issue Apr 7, 2022 · 6 comments
Closed

ModuleNotFoundError: No module named 'staramr' #142

neelam19051 opened this issue Apr 7, 2022 · 6 comments

Comments

@neelam19051
Copy link

Hi, I am trying to install 'staramr' and i am getting this error-
Does anyone know how to solve it?

Traceback (most recent call last):
File "/home/bvs/neelam/staramr/bin/staramr", line 44, in
from staramr import version
ModuleNotFoundError: No module named 'staramr'

Thank you!

@apetkau
Copy link
Member

apetkau commented Apr 7, 2022

Hello @neelam19051, how did you install staramr? Was it using conda? Pip? Did you clone from GitHub? Which version of Python are you using (python --version)?

@neelam19051
Copy link
Author

neelam19051 commented Apr 7, 2022

Actually i installed it with git clone and after that i also installed with pip (Python 3.8) then it didn't show that error and help manual run perfectly fine but when i try run this commands *staramr search -o out .fna it show this following error -

[Errno 39] Directory not empty: '/tmp/tmpb4uhg5zk'
Traceback (most recent call last):
File "/tmp/home/bvs/neelam/lib/python3.8/site-packages/staramr/subcommand/Search.py", line 283, in _generate_results
amr_detection.run_amr_detection(files,pid_threshold, plength_threshold_resfinder,
File "/tmp/home/bvs/neelam/lib/python3.8/site-packages/staramr/detection/AMRDetection.py", line 177, in run_amr_detection
self._amr_detection_handler.run_blasts_mlst(files, mlst_scheme)
File "/tmp/home/bvs/neelam/lib/python3.8/site-packages/staramr/blast/JobHandler.py", line 113, in run_blasts_mlst
mlst_result = future_mlst.result()
File "/tmp/home/bvs/neelam/lib/python3.8/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/tmp/home/bvs/neelam/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/tmp/home/bvs/neelam/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/tmp/home/bvs/neelam/lib/python3.8/site-packages/staramr/blast/JobHandler.py", line 154, in _schedule_mlst
output = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
File "/tmp/home/bvs/neelam/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/tmp/home/bvs/neelam/lib/python3.8/subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/tmp/home/bvs/neelam/lib/python3.8/subprocess.py", line 1706, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mlst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/bvs/neelam/staramr/bin/staramr", line 68, in
args.run_command(args)
File "/tmp/home/bvs/neelam/lib/python3.8/site-packages/staramr/subcommand/Search.py", line 447, in run
results = self._generate_results(database_repos=database_repos,
File "/tmp/home/bvs/neelam/lib/python3.8/site-packages/staramr/subcommand/Search.py", line 319, in _generate_results
results['settings'] = settings
File "/tmp/home/bvs/neelam/lib/python3.8/tempfile.py", line 827, in exit
self.cleanup()
File "/tmp/home/bvs/neelam/lib/python3.8/tempfile.py", line 831, in cleanup
self._rmtree(self.name)
File "/tmp/home/bvs/neelam/lib/python3.8/tempfile.py", line 813, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "/tmp/home/bvs/neelam/lib/python3.8/shutil.py", line 722, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "/tmp/home/bvs/neelam/lib/python3.8/shutil.py", line 720, in rmtree
os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/tmp/tmpb4uhg5zk'

Thank you

@apetkau
Copy link
Member

apetkau commented Apr 7, 2022

If possible you will likely want to install staramr using the Bioconda instructions (https://github.com/phac-nml/staramr#bioconda). Conda/bioconda will install all the necessary non-Python dependencies (like the software mlst which is missing and causing the error above).

You can install outside of conda/bioconda too, but then you have to install the following dependencies in addition to pip install staramr: https://github.com/phac-nml/staramr#dependencies

@neelam19051
Copy link
Author

Hi, again i encountered some error, even i installed it with the help of bioconda staramr and the script was same -

ERROR ##'NoneType' object has no attribute 'tolist'##

Traceback (most recent call last):
File "/home/bvs/anaconda3/envs/myenv/bin/staramr", line 68, in
args.run_command(args)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/subcommand/Search.py", line 468, in run
unacceptable_num_contigs= args.unacceptable_num_contigs)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/subcommand/Search.py", line 286, in _generate_results
report_all_blast, ignore_invalid_files, mlst_scheme)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/detection/AMRDetection.py", line 198, in run_amr_detection
self._pointfinder_dataframe, self._plasmidfinder_dataframe, self._mlst_dataframe)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/detection/AMRDetectionResistance.py", line 70, in _create_amr_summary
return amr_detection_summary.create_summary(self._include_negative_results)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/results/AMRDetectionSummary.py", line 134, in create_summary
resistance_frame = self._compile_results(resistance_frame)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/results/AMRDetectionSummaryResistance.py", line 43, in _compile_results
.aggregate(self._aggregate_gene_phenotype)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 1010, in aggregate
result = gba.agg()
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/apply.py", line 164, in agg
return self.agg_list_like()
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/apply.py", line 355, in agg_list_like
new_res = colg.aggregate(arg)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 249, in aggregate
ret = self._aggregate_multiple_funcs(func)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 303, in _aggregate_multiple_funcs
results[key] = self.aggregate(func)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 265, in aggregate
return self._python_agg_general(func, *args, **kwargs)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 1332, in _python_agg_general
result = self.grouper.agg_series(obj, f)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/ops.py", line 1060, in agg_series
result = self._aggregate_series_fast(obj, func)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/ops.py", line 1085, in _aggregate_series_fast
result, _ = sgrouper.get_result()
File "pandas/_libs/reduction.pyx", line 281, in pandas._libs.reduction.SeriesGrouper.get_result
File "pandas/_libs/reduction.pyx", line 88, in pandas._libs.reduction._BaseGrouper._apply_to_group
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 1318, in
f = lambda x: func(x, *args, **kwargs)
File "/home/bvs/anaconda3/envs/myenv/lib/python3.7/site-packages/staramr/results/AMRDetectionSummaryResistance.py", line 25, in _aggregate_gene_phenotype
flattened_phenotype_list = [y.strip() for x in dataframe.get('Predicted Phenotype').tolist() for y in
AttributeError: 'NoneType' object has no attribute 'tolist'

Thank you

@apetkau
Copy link
Member

apetkau commented Apr 11, 2022

Thanks. This looks an awful lot like this issue #136. I believe the solution is to downgrade the pandas package:

# Or if this does'nt work you can try 'pip install' instead
conda install pandas==1.1.5

@apetkau
Copy link
Member

apetkau commented May 18, 2022

Fixed in #146

@apetkau apetkau closed this as completed May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants