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

" 'module' has no attribute 'which' "after installation #11

Closed
geboro opened this issue Aug 9, 2017 · 5 comments
Closed

" 'module' has no attribute 'which' "after installation #11

geboro opened this issue Aug 9, 2017 · 5 comments

Comments

@geboro
Copy link

geboro commented Aug 9, 2017

Hello.
The test suite is failing with:

Traceback (most recent call last):
File "test_suite.py", line 632, in
test_quick()
File "test_suite.py", line 623, in test_quick
rerun_test()
File "test_suite.py", line 595, in rerun_test
QuickTests().run()
File "test_suite.py", line 404, in run
self.setUp()
File "test_suite.py", line 394, in setUp
os.mkdir(self.working_wd_loc)
OSError: [Errno 2] No such file or directory: '~/Software/drep/tests/../tests/test_backend/ecoli_wd'

And I can see that subdirectory "test_backend" is indeed not in there, and not in the github repo.

However, dRep is also failing while running the test dataset on its own as:

/home/Software/drep/tests $ dRep compare_wf outputdir/ -g ./genomes/*fasta
Step 1. Cluster
Traceback (most recent call last):
File "/home/Software/BioTools/Anaconda/bin/dRep", line 26, in
controller.parseArguments(args)
File "/home/Software/BioTools/Anaconda/lib/python2.7/site-packages/drep/controller.py", line 146, in parseArguments
self.compare_wf_operation(**vars(args))
File "/home/Software/BioTools/Anaconda/lib/python2.7/site-packages/drep/controller.py", line 91, in compare_wf_operation
drep.d_workflows.compare_wrapper(kwargs['work_directory'],**kwargs)
File "/home/Software/BioTools/Anaconda/lib/python2.7/site-packages/drep/d_workflows.py", line 92, in compare_wrapper
drep.d_cluster.d_cluster_wrapper(wd, **kwargs)
File "/home/Software/BioTools/Anaconda/lib/python2.7/site-packages/drep/d_cluster.py", line 282, in d_cluster_wrapper
Bdb, data_folder, kwargs = parse_arguments(workDirectory, **kwargs)
File "/home/Software/BioTools/Anaconda/lib/python2.7/site-packages/drep/d_cluster.py", line 311, in parse_arguments
loc = shutil.which('mash')
AttributeError: 'module' object has no attribute 'which'

I get this exact last error when running with my data too, which leads me this should be related ti an overall installation problem. I also reinstalled it through pip and have the same result.
I am running on Ubuntu 16.04, and set pyenv to run globally with python 2.7.9 and 3.5.1...

Any idea what might be going wrong?

@MrOlm
Copy link
Owner

MrOlm commented Aug 9, 2017

Hello,

Thanks for checking out the program.

I can see from the log you pasted above that dRep is running from python2.7, while it needs to be installed in python3.

As you already have pyenv setup, this should be very easy to do, involving just two commands-

pyenv global 3.5.1

pip install drep

Please let me know if this is unclear, or if the problem still persists.

Best,
-Matt

@geboro
Copy link
Author

geboro commented Aug 10, 2017

Thanks for pointing that out!
It seems that if pip is installed under python2, in order to install packages under python3 then we need to either make a virtual environment under python3 or install with pip3 (for Ubuntu). I'm leaving this here as reference:

sudo apt-get install python3-pip sudo pip3 install .

The test_suite is still failing, though, because the nonexistent 'test_backend/ecoli_wd' directory. I ran it manually, as suggested in another thread, and it seems to work ./bin/dRep compare_wf outputdir/ -g ./tests/genomes/*

@MrOlm
Copy link
Owner

MrOlm commented Aug 10, 2017 via email

@hzafeng
Copy link

hzafeng commented Sep 27, 2017

Hello.
I have set the global env of python:

[zjs@www bins]$ pyenv global
anaconda-2.0.0
3.5.1

but I still fail down the step when DREP call CheckM,

[CheckM - qa] Tabulating genome statistics.


Calculating AAI between multi-copy marker genes.

Reading HMM info from file.

Unexpected error: <type 'exceptions.IOError'>
Traceback (most recent call last):
File "/home/zjs/hhf/soft/CheckM-1.0.7/bin/checkm", line 712, in
checkmParser.parseOptions(args)
File "/home/zjs/tools/anaconda2/lib/python2.7/site-packages/checkm/main.py", line 1235, in parseOptions
self.qa(options)
File "/home/zjs/tools/anaconda2/lib/python2.7/site-packages/checkm/main.py", line 396, in qa
binIdToModels = markerSetParser.loadBinModels(hmmModelInfoFile)
File "/home/zjs/tools/anaconda2/lib/python2.7/site-packages/checkm/markerSets.py", line 525, in loadBinModels
with gzip.open(filename, 'rb') as f:
File "/home/zjs/tools/anaconda2/lib/python2.7/gzip.py", line 34, in open
return GzipFile(filename, mode, compresslevel)
File "/home/zjs/tools/anaconda2/lib/python2.7/gzip.py", line 94, in init
fileobj = self.myfileobj = builtin.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: '/mnt/js/trimmomatic/108_need_out/done/pig1_binning_done/binning/split/bins/bins/dereplicate_wf/data/checkM/checkM_outdir/storage/checkm_hmm_info.pkl.gz'
!!! checkM failed !!!

How can I solve this problem?

@MrOlm
Copy link
Owner

MrOlm commented Sep 27, 2017

Hello,

Has checkM been properly installed? There are some steps that have to be run for it to work properly, like running the command:

checkm data update

See https://github.com/Ecogenomics/CheckM/wiki/Installation for more detailed instructions.

What is the response when you try the command:

$ checkm -h

?

What about the command:

$ drep bonus test --check_dependencies

?

Best,
-Matt

@MrOlm MrOlm closed this as completed Oct 19, 2017
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

3 participants