Python command not found on local Galaxy istance

Hi everyone,
I installed Galaxy 23.2.1 on a VM with Ubuntu 22.04.2 . It is running fine and I was able to load and run some tools that I developed. The problem is that with some tools (both mine or already in the toolshed) I got the following error:

/home/andrea/galaxy/database/jobs_directory/000/10/tool_script.sh: line 9: python: command not found

I got it also if I try to load some data from my PC (a simple tabular file with 5 genes symbol in it).
In the tool dependencies I already checked that python is installed and also in the .venv environment is correctly installed.
What could raise this error?
Thank you very much for the help.

Hi @Andrea_Furlani

There is a problem with the runtime environment, probably the PYTHONPATH.

Are you using Conda for the .venv and for tool dependency resolution? If not, that is the first adjustment to make. Using a Python .venv for a Galaxy installation will lead to all sort of problems.

The minimum is 3.7 and I’m not sure which others should be avoided or if there is an upper limit. Let’s see if someone else answers about that. Meanwhile, you can check and let us know what happens on your side.

XRef:

I followed the instruction from here, but now when running Galaxy I get the following error:

Feb 27 12:32:37 ubuntu galaxyctl[2940]: Traceback (most recent call last):
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/webapps/galaxy/buildapp.py", line 59, in app_pair
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     app = galaxy.app.UniverseApplication(global_conf=global_conf, is_webapp=True, **kwargs)
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/app.py", line 691, in __init__
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     self._configure_toolbox()
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/app.py", line 346, in _configure_toolbox
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     ToolBoxSearch(self.toolbox, index_dir=self.config.tool_search_index_dir, index_help=index_help),
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/tools/search/__init__.py", line 100, in __init__
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     config=toolbox.app.config,
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/tools/search/__init__.py", line 197, in __init__
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     self.index = self._index_setup()
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/tools/search/__init__.py", line 201, in _index_setup
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     return get_or_create_index(self.index_dir, self.schema)
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/lib/galaxy/tools/search/__init__.py", line 73, in get_or_create_index
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     if index.exists_in(index_dir):
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/.venv/lib/python3.7/site-packages/whoosh/index.py", line 136, in exists_in
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     ix = open_dir(dirname, indexname=indexname)
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/.venv/lib/python3.7/site-packages/whoosh/index.py", line 123, in open_dir
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     return FileIndex(storage, schema=schema, indexname=indexname)
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/.venv/lib/python3.7/site-packages/whoosh/index.py", line 421, in __init__
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     TOC.read(self.storage, self.indexname, schema=self._schema)
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/.venv/lib/python3.7/site-packages/whoosh/index.py", line 664, in read
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     segments = stream.read_pickle()
Feb 27 12:32:37 ubuntu galaxyctl[2940]:   File "/home/andrea/galaxy/.venv/lib/python3.7/site-packages/whoosh/filedb/structfile.py", line 245, in read_pickle
Feb 27 12:32:37 ubuntu galaxyctl[2940]:     return load_pickle(self.file)
Feb 27 12:32:37 ubuntu galaxyctl[2940]: ValueError: unsupported pickle protocol: 5
Feb 27 12:32:37 ubuntu systemd[1]: galaxy-gunicorn.service: Main process exited, code=exited, status=1/FAILURE
Feb 27 12:32:37 ubuntu systemd[1]: galaxy-gunicorn.service: Failed with result 'exit-code'.
Feb 27 12:32:37 ubuntu systemd[1]: galaxy-gunicorn.service: Consumed 6.941s CPU time.
Feb 27 12:32:38 ubuntu systemd[1]: galaxy-gunicorn.service: Scheduled restart job, restart counter is at 39.
Feb 27 12:32:38 ubuntu systemd[1]: Stopped Galaxy gunicorn.
Feb 27 12:32:38 ubuntu systemd[1]: galaxy-gunicorn.service: Consumed 6.941s CPU time.

From my understanding, this pickle module is available only for versions after Python 3.8 (in the .venv created by conda it is 3.7).

EDIT: After deleting several times both .venv and galaxy I’m able to run again Galaxy but I’m at the same point as before since I’m getting the “python: command not found” error.

Hi @Andrea_Furlani

Whopps! That GetGalaxy.org doc I was referencing about the minimum python version is incorrect. At the main repository this is clarified accurately.

Then scroll down to the README

Galaxy Quickstart

Galaxy requires Python 3.8 . To check your Python version, run:

$ python -V Python 3.8.18



So, I’ll fix the documentation! So sorry that I missed the mixup. Ticket Correct the minimum python version by jennaj · Pull Request #2444 · galaxyproject/galaxy-hub · GitHub

But at least we know now what to do … please try installing a supported Python version to see what happens.

I’m also wondering if we can add something to the start up scripts that can warn about this situation in a clearer way. Request ticket for this Enhancement: Trap if an unsupported version of python is used in start up scripts · Issue #17590 · galaxyproject/galaxy · GitHub

Thanks for following up!

@Andrea_Furlani Can you share the source of the tool for which you are having this issue? I don’t think this is a problem with the Python version you are using for Galaxy.

1 Like

Hi @nsoranzo, thanks for your reply. I’m using the instructions from here.
But I’m having the issue with both version 23.2 and 23.1

I’ve seen the error: ValueError: unsupported pickle protocol: 5 when downgrading/upgrading versions of Python used by Galaxy.

Try to delete the tool index cache as explained here Pickle issue when bringing back up an existing Galaxy · Issue #11470 · galaxyproject/galaxy · GitHub and see if that gets rid of your error.

1 Like

Hi @davelopez , thanks for your reply but after a clean installation of Galaxy and using conda as venv I don’t have anymore this issue.
Now I’m just stuck with the no Python error

As mentioned above, can you share the source of the tool for which you are having this issue? This is likely a missing requirement in your tool XML.

1 Like

Sorry @nsoranzo but I don’t understand what do you mean with sharing the source. The tool that I’m testing is just the “upload data” button above the tools list on the left, but actually I get it with every tool I test.

A small update: I tried a different approach. I installed first Galaxy 21.09 (the last one working for me) and then tried to update to the last version. It is still not working, but I get a different error message:

Mar 08 11:57:28 ubuntu galaxyctl[85258]: [2024-03-08 11:57:28 +0000] [85258] [ERROR] Exception in ASGI application
Mar 08 11:57:28 ubuntu galaxyctl[85258]: Traceback (most recent call last):
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 151, in get_asynclib
Mar 08 11:57:28 ubuntu galaxyctl[85258]: KeyError: 'anyio._backends._asyncio'
Mar 08 11:57:28 ubuntu galaxyctl[85258]: During handling of the above exception, another exception occurred:
Mar 08 11:57:28 ubuntu galaxyctl[85258]: Traceback (most recent call last):
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 284, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/starlette_context/middleware/raw_middleware.py", line 93, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 29, in __call__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/anyio/_core/_synchronization.py", line 79, in __new__
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/home/andrea/galaxy/.venv/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 153, in get_asynclib
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "/root/anaconda3/lib/python3.11/importlib/__init__.py", line 126, in import_module
Mar 08 11:57:28 ubuntu galaxyctl[85258]:     return _bootstrap._gcd_import(name[level:], package, level)
Mar 08 11:57:28 ubuntu galaxyctl[85258]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
Mar 08 11:57:28 ubuntu galaxyctl[85258]:   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
Mar 08 11:57:28 ubuntu galaxyctl[85258]: ModuleNotFoundError: No module named 'anyio._backends._asyncio'

I was able to install the last version with gunicorn running correctly, but again I’m getting “python: command not found”