Failed to find virtualenv when building galaxy from ansible tutorial

Trying to install 25.1 on ubuntu 24.04 following ansible install tutorial

After 72 tasks (ok=38, skipped=34), it fails looking for executable “virtualenv”:

TASK [galaxyproject.galaxy : Report Galaxy version change]
skipping: [localhost]
TASK [galaxyproject.galaxy : Create Galaxy virtualenv]
fatal: [localhost]: FAILED! => changed=false
msg: ‘Failed to find required executable “virtualenv” in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/snap/bin’

I understand I’m trying 25.1 and the tutorial is for 25.0, but I suspect that is not the problem.

The packages

python3-venv
python3-pip-whl

are installed, but

python3-pip

is not.

I do not see the variable galaxy_virtualenv_command defined anywhere except to equate it to pip_virtualenv_command.

$ ansible –version
ansible [core 2.16.3]
  config file = /home/me/galaxy/galaxy/ansible.cfg
  configured module search path = [‘/home/me/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/me/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.3 (main, Jan 22 2026, 20:57:42) [GCC 13.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Hello @GaryAitken

Thanks for sharing all of the details! If you do try this with the original tutorial version, does it at least get past this step? This would help to test your environment versus the release being a factor.

Let’s start there, thanks! :slight_smile:

Not sure what you mean by “try this with the original tutorial version.” If you mean try it with galaxy 25.0, here’s what I did: (Please let me know if this isn’t what you meant…)

1. edit group_vars/galaxyservers.yml
2. change
     galaxy_commit_id: release_25.1
   to
     galaxy_commit_id: release_25.0
2. ansible-playbook galaxy.yml | tee playbook_galaxy_25.0_20260303_2106.log

That yields the same result:

msg: ‘Failed to find required executable “virtualenv” in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin”

I did NOT clear any subdirectories. I’m assuming changing the commit version should be sufficient to cause the build process to fetch any appropriate changed files?

I’m guessing this has to do with changes in the way python3.12 works by default, or at least the ubuntu_24.04 package, where python3-pip is not installed and maybe therefore the command “virtualenv” may not be present. I don’t know squat about python so don’t want to mess up the build process by installing things not normally there.

In the /usr/lib/python3/dist-packages/ tree there is no virtualenv.py

/usr/lib/python3/dist-packages$ find . -type f | grep virtualenv.py
/usr/lib/python3/dist-packages$

The package python3-pip, which is not installed, does install a virtualenv.py:

  $ sudo apt-file list python3-pip | grep virtualenv
  python3-pip: /usr/lib/python3/dist-packages/pip/_internal/utils/virtualenv.py

There is also a package python3-setuptools which is installed, but it does not install a pip or virtualenv.

BTW, this ubuntu_24.04 is the result of an upgrade from ubuntu_22.04. I don’t have a log of the upgrade process.

Hi @GaryAitken

Thank you for sharing more details! I see what seems to be the problem now.

For reference, your OS and Python should be supported.

I would recommend that you install virtualenv for the purposes of the tutorial. You can add this along with pip. These both are called out as requirements here:



Requirements

This role has the same dependencies as the git module. In addition, pip and Python virtualenv are required. These can easily be installed via a pre-task in the same play as this role:



Other types of installs can do this slightly differently. If you are curious later on about alternative install configurations, this is a good place to start.

Please give this a try and let us know what happens! :slight_smile:

I tried installing python3-pip and that made no difference.

I then installed virtualenv, and was able to continue with the “ansible-playbook galaxy.yml” (but did not complete successfully, see below).

Since I did not uninstall python3-pip before installing virtualenv, it’s not clear whether python3-pip is actually required or not. However, it appears virtualenv currently is a requirement which is not satisfied in the tutorial.

There may be an assumption that having a python3 installed implies that virtualenv will also be installed. That appears to be incorrect for more recent versions of python; particularly since (it’s my understanding that) virtualenv is a third-party package.

I subsequently removed the package python3-pip (again, did NOT clean any subdirectories), and got to the task:

TASK [galaxyproject.galaxy : Install or upgrade node]
fatal: [localhost]: FAILED! => changed-true
  cmd:
  - nodeenv
  - -n
  - 22.13.0
  - -p
...
  msg: non-zero return code
  rc: 1
  start ...
  stderr: |2-
     * Install prebuilt node (22.13.0) ....
     Traceback (most recent call last):
       File "/srv/galaxy/venv/lib/python3.12/site-packages/nodeenv.py", line 664, in copytree
         shutil.copytree(s, d, symlinks, ignore)
       File "/usr/lib/python3.12/shutil.py", line 600 in copytree
         return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "/usr/lib/python3.12/shutil.py", line 498, in copytree
         os.makedirs(dst, exist_ok=dirs_exist_ok)
       File "<frozen os>?, line 225, in makedirs
     FileExistsError: [Errno 17] File exists: '/srv/galaxy/venv/bin'
...
localhost : ok=76 changed=2 unreachable=0 failed=1 skipped=65 rescued=0 ignored=0

It appears it’s complaining because /srv/galaxy/venv/bin/ already exists, the result of the previous build attempt. Is dirs_exist_ok a configuration variable which can (and should be) be set when re-running the build? Or something else should be done?

Oops, looks like we overlapped.

I reinstalled python3-pip and reran, but the above error persists.

In both runs there was an additional error that I left out, which is probably the real error:

FileExistsError: [Errno 17] File exists: ‘../lib/node_modules/npm/bin/npx-cli.js’ → ‘/srv/galaxy/venv/bin/npx’

If you would like to suggest an update to the tutorial, see the upper right corner of the tutorial web page. I agree that the link that points to the role, and then requirements, is a bit nested and could be made much more obvious, especially for new administrators!

The integration tests I linked for Ubuntu and Python are where all of the these dependencies were tested. That said, improving the materials is always a good idea and is how they are as flushed out as they are now! Feedback or direct contributions are what makes Galaxy, Galaxy! If you think more about Ubutu (and the various versions) versus other OSs could use a stronger call out or warning, please suggest! :slight_smile:

Then for this

Yes, as far as I know, you’ll want to have both installed for the purposes of the tutorial. Given your OS, this would be by direct install as a pre-task.

Where to source both of these packages:

Directly, these are

You’ll want to also source these from the same places. You can add these to your playbook if you want so that these baseline framework dependencies are available to your instance.

Please give this a try and let us know how it works! :rocket:

Thanks for the pointer to the galaxy readme with requirements. I have some notes on suggested clarifications in the tutorial, but am waiting until I finish it to submit.

I’ve incorporated the pip and virtualenv requirements, thanks.

I’m now farther along, but it dies consistently with a FileExistsError:

TASK [galaxyproject.galaxy : Install or upgrade node] **************************
fatal: [localhost]: FAILED! => changed=true
cmd:
- nodeenv
- -n
- 22.13.0
- -p
msg: non-zero return code
rc: 1
start: '2026-03-04 14:53:24.506260'
stderr: |2-
   * Install prebuilt node (22.13.0) ....
  Traceback (most recent call last):
    File "/srv/galaxy/venv/lib/python3.12/site-packages/nodeenv.py", line 664,
 in copytree
      shutil.copytree(s, d, symlinks, ignore)
    File "/usr/lib/python3.12/shutil.py", line 600, in copytree
      return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/shutil.py", line 498, in _copytree
      os.makedirs(dst, exist_ok=dirs_exist_ok)
    File "<frozen os>", line 225, in makedirs
  FileExistsError: [Errno 17] File exists: '/srv/galaxy/venv/bin'

  During handling of the above exception, another exception occurred:
...
  FileExistsError: [Errno 17] File exists: '../lib/node_modules/npm/bin/npx-cl
i.js' -> '/srv/galaxy/venv/bin/npx'

It’s not clear to me whether it is complaining about the directory /srv/galaxy/venv/bin existing, or the file /srv/galaxy/venv/bin/npx. It’s also unclear to me why the file npx-cli.js would be copied to a file with the name npx. The /srv/galaxy/venv/bin directory has 257 files in it, all with a time of Mar 4 12:12; it’s now 15:19, so they were created on an earlier attempt. In any case, suggestions on how to proceed?