nanoporetech / megalodon

Megalodon is a research command line tool to extract high accuracy modified base and sequence variant calls from raw nanopore reads by anchoring the information rich basecalling neural network output to a reference genome/transriptome.
Other
197 stars 30 forks source link

Pointing megalodon to python < 3.9 #166

Closed rajitz closed 3 years ago

rajitz commented 3 years ago

Hi,

I am trying to run the following command with the default python being set to 3.8 instead of 3.9 (since the Guppy backend needs python < 3.9):

megalodon /Users/rajats/Documents/Projects/MinION_Runs/ZymoControl/20210628_1515_MC-111208_0_AGW628_dbf99d27-20210630T144847Z/20210628_1515_MC-111208_0_AGW628_dbf99d27/fast5_pass/ --guppy-params "-d ./rerio/basecall_models/" --guppy-config res_dna_r941_min_modbases_5mC_5hmC_CpG_v001.cfg --outputs basecalls mappings mod_mappings mods per_read_mods --reference reference.fa --mod-motif mh CG 0 --processes 8 --guppy-server-path /Users/rajats/Documents/Software/ont-guppy-cpu/bin/guppy_basecall_server --verbose-read-progress 3 --output-directory /Users/rajats/Documents/Projects/MinION_Runs/ZymoControl/ZymoControl_Results --overwrite

I'm getting the following error message:

[16:04:40] Loading guppy basecalling backend. Traceback (most recent call last): File "/Users/rajats/miniconda3/bin/megalodon", line 8, in sys.exit(_main()) File "/Users/rajats/miniconda3/lib/python3.9/site-packages/megalodon/main.py", line 361, in _main megalodon._main(args) File "/Users/rajats/miniconda3/lib/python3.9/site-packages/megalodon/megalodon.py", line 1071, in _main with backends.ModelInfo(backend_params, args.processes) as model_info: File "/Users/rajats/miniconda3/lib/python3.9/site-packages/megalodon/backends.py", line 418, in init self._load_pyguppy() File "/Users/rajats/miniconda3/lib/python3.9/site-packages/megalodon/backends.py", line 409, in _load_pyguppy set_pyguppy_model_attributes() File "/Users/rajats/miniconda3/lib/python3.9/site-packages/megalodon/backends.py", line 371, in set_pyguppy_model_attributes init_client.connect() File "/Users/rajats/miniconda3/lib/python3.9/site-packages/pyguppyclient/client.py", line 73, in connect config = self._load_config(self.config_name) File "/Users/rajats/miniconda3/lib/python3.9/site-packages/pyguppyclient/client.py", line 95, in _load_config loaded_configs = {Config(c).name: Config(c) for c in self.get_configs()} File "/Users/rajats/miniconda3/lib/python3.9/site-packages/pyguppyclient/client.py", line 92, in get_configs return [res.Configs(i) for i in range(res.ConfigsLength())] AttributeError: 'NoneType' object has no attribute 'ConfigsLength'

These are the software versions:

python --version
Python 3.8.11

python3 --version Python 3.8.11

guppy_basecall_server --version : Guppy Basecall Service Software, (C) Oxford Nanopore Technologies, Limited. Version 5.0.11+2b6dbffa5, client-server API version 7.0.0

megalodon --version Megalodon version: 2.1.0

Perhaps the issue is that when I do "pip install megalodon", it gets installed within /Users/rajats/miniconda3/bin where python3.9 is installed.

Is there a way to point the Guppy backend to python 3.8 or another way to fix this issue?

Python 3.9 came installed on the Mac so I really don't want to uninstall it unless that's the only solution here.

Thanks very much! Rajat

marcus1487 commented 3 years ago

There are a number of ways to address python version issues. I would recommend using a virtual environment (python3.8 -m venv venv; source venv/bin/activate).

But this error does not appear to be due to a python3.9 installation. This megalodon version is a bit out of date. I would recommend updating to the most recent megalodon version. Hopefully this will resolve this issue.

rajitz commented 3 years ago

Thanks for getting back. I had done the standard "pip install megalodon". Should I do the following instead to get the latest version?

git clone https://github.com/nanoporetech/megalodon pip install -e megalodon

Cheers, Rajat

marcus1487 commented 3 years ago

Ah it might be that your pip is linked to python3.9, which might be forcing the megalodon version back to 2.1 as this might be the last version to not include the pyguppy dependency. To ensure you are using pip linked to python3.8 you could use python3.8 -m pip install megalodon. I would run pip uninstall megalodon (possibly several times until it indicates that no megalodon installation is found) in order to remove the current install first.

rajitz commented 3 years ago

I was indeed able to upgrade to v2.3.3 that way and get the command going. Appreciate your help! Rajat