ModuleNotFoundError for <code file=

Hello!
I have an xml file that is using the <code file= tag.
I know the library containing the module is there but Galaxy does not seem to find it.
I must be doing something wrong…
I wonder if you can help me out.
Thanks!
Details:

xml:



graphlan_prepare_annotations.py
–input $inp_data
–output_annot_file $output_annot_file
etc etc.

The error:
galaxy.tools.toolbox.base ERROR 2022-01-17 02:59:38,165 [p:2973,w:0,m:0] [MainThread] Error reading tool from path: galaxy_graphlan/graphlan_annotate.xml
Traceback (most recent call last):
File “lib/galaxy/tools/toolbox/base.py”, line 659, in _load_tool_tag_set
tool = self.load_tool(concrete_path, use_cached=False, tool_cache_data_dir=tool_cache_data_dir)
File “lib/galaxy/tools/toolbox/base.py”, line 855, in load_tool
tool = self.create_tool(config_file=config_file, tool_shed_repository=tool_shed_repository, guid=guid, tool_cache_data_dir=tool_cache_data_dir, **kwds)
File “lib/galaxy/tools/init.py”, line 302, in create_tool
tool = self._create_tool_from_source(tool_source, config_file=config_file, **kwds)
File “lib/galaxy/tools/init.py”, line 320, in _create_tool_from_source
return create_tool_from_source(self.app, tool_source, **kwds)
File “lib/galaxy/tools/init.py”, line 238, in create_tool_from_source
tool = ToolClass(config_file, tool_source, app, **kwds)
File “lib/galaxy/tools/init.py”, line 522, in init
raise e
File “lib/galaxy/tools/init.py”, line 519, in init
self.parse(tool_source, guid=guid, dynamic=dynamic)
File “lib/galaxy/tools/init.py”, line 860, in parse
self.__parse_legacy_features(tool_source)
File “lib/galaxy/tools/init.py”, line 944, in _parse_legacy_features
exec(compiled_code, self.code_namespace)
File "futurized
/galaxy-central/tools/galaxy_graphlan/graphlan_format_input_selector.py", line 8, in
ModuleNotFoundError: No module named ‘pyphlan.pyphlan’; ‘pyphlan’ is not a package

Structure of my directory:

(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan# pwd
/export/galaxy-central/tools/galaxy_graphlan
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan# ls -lh
total 72K
-rw-r–r–+ 1 root galaxy 13K Jan 17 01:43 graphlan_annotate.xml
-rwxr-xr-x+ 1 root galaxy 1.1K Jan 16 20:48 graphlan_format_input_selector.py
-rwxr-xr-x+ 1 root galaxy 14K Jan 16 19:24 graphlan_prepare_annotations.py
-rwxr-xr-x+ 1 root galaxy 1.8K Jan 16 19:24 graphlan_prepare_ring_annotations.py
-rw-r–r–+ 1 root galaxy 6.0K Jan 16 19:24 graphlan_ring_annotate.xml
-rw-r–r–+ 1 root galaxy 2.4K Jan 16 19:24 graphlan.xml
drwxr-xr-x+ 3 root galaxy 4.0K Jan 16 19:24 pyphlan
-rw-r–r–+ 1 root galaxy 1.8K Jan 16 19:24 readme1.md
-rw-r–r–+ 1 root galaxy 1.6K Jan 16 19:24 Readme_Graphlan_Galaxy.txt
-rwxr-xr-x+ 1 root galaxy 971 Jan 16 19:24 test1.sh
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan#
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan#
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan#
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan#
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan#
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan# ls -lh pyphlan
total 176K
-rw-r–r–+ 1 root galaxy 53K Jan 16 19:24 graphlan_lib_BackupGW.py
-rw-r–r–+ 1 root galaxy 53K Jan 16 19:24 graphlan_lib.py
-rw-r–r–+ 1 root galaxy 0 Jan 16 19:24 init.py
drwxr-xr-x+ 2 root galaxy 115 Jan 16 19:24 pycache
-rw-r–r–+ 1 root galaxy 28K Jan 16 19:24 pyphlan_BackupGW.py
-rw-r–r–+ 1 root galaxy 29K Jan 16 19:24 pyphlan.py
(base) root@5cc594913c8f:/export/galaxy-central/tools/galaxy_graphlan#

========================================================
Imports in graphlan_prepare_annotations.py

#!/usr/bin/env python
import argparse
from io import StringIO
import sys
import string
import time
import pyphlan.pyphlan as circlib
import os
from time import gmtime, strftime
from pprint import pprint

===================
Imports in graphlan_format_input_selector.py

#!/usr/bin/env python
import sys
import string
import time
import pyphlan.pyphlan as pyphlan

Hi @george.weingart , Galaxy seems to partially find your package, otherwise the exception would have been ModuleNotFoundError: No module named 'pyphlan' . If you need more help, it would be easier if you can share the whole XML and Python code, e.g. if that’s already on a GitHub repository.

1 Like

Hello Nicola !
Thank you so much for your offer to help, it is greatly appreciated.
I am glad to tell you that when I was preparing documentation to send you, I found the issue.
I was not copying the pyphlan library to / /export/galaxy-central/lib. Now that we are doing that, we are OK.
Thanks again !!!
George Weingart PhD
Huttenhower Lab
Harvard School of Public Health

2 Likes