Access denied on virtualenv with trellis-cli on Windows

I’m getting an access denied error withtrellis init on Windows 10 (running from Powershell with admin rights) :

←[0mvirtualenv not found←[0m
⠧ Installing virtualenv... 2021/12/16 13:40:24 rename pypa-virtualenv-4338408 C:\Users\chris\.local\share\trellis\virtualenv: Access is denied.

However, I can run a vagrant up with no issues.

Any tip on how to fix that access denied error?


Anything other than WSL is unsupported. Can you please try from WSL?

I have WSL up and running but the trellis init is run outside the wsl box otherwise I’m getting an SSH error.

All of it needs to be ran from WSL. What is the SSH error? Have you tried following our getting started docs for Windows?

Yes I have read and set my project as described in the starter guide for Windows + wsl users but I ended up with an SSH error (timeout).

I’ve just noticed that I’m getting an error from WSL too with the trellis new mytest.test

Creating virtualenv in /mnt/d/Projects/mytest.test/trellis/.trellis/virtualenv
Error creating virtualenv: exit status 1
ERROR! Unexpected Exception, this is probably a bug: cannot import name 'CollectionRequirement' from 'ansible.galaxy.collection' (/home/phxitm/.local/lib/python3.8/site-packages/ansible/galaxy/collection/

Error running ansible-galaxy: exit status 250

mytest.test project created with versions:
  Trellis v1.11.0
  Bedrock v1.18.0

Any update on this issue?

Sorry I missed this until now.

There’s 3 errors in your output which makes it confusing, but it’s the first error causing the other two. trellis-cli creates a Python virtual environment where it installs dependencies (like Ansible). Since the virtualenv failed to create, dependencies couldn’t be installed either which just leads to more errors.

I just published v1.4.0 which should help in two ways:

  1. it provides much better error messages in cases like this, which should help debug at least
  2. it will fail earlier during trellis new so it’s much more obvious

If you could upgrade and run trellis new mytest.test again, hopefully we can figure out what’s going wrong.

I’ve just installed the v1.4.0 and this is the error output I’m getting :

Creating new Trellis project in /mnt/d/Projects/mytest.test

Site domain [mytest.test]:

✔ mytest.test
Initializing project

[✘] Error creating virtualenv
exit status 1

Project initialization failed due to the error above.

trellis-cli tried to create a virtual environment but failed.
  => /usr/bin/python3 -m venv

Without a Python virtual environment the required dependencies (eg: Ansible) can't be installed.

There are two options:
  1. Ensure Python 3 is installed and the `python3` command works. trellis-cli will use python3's built-in venv feature.
  2. Disable trellis-cli's virtual env feature by setting this env variable: export TRELLIS_VENV=false

This could also be a bug in trellis-cli. Please create an issue at and include the output above.

Thanks for trying it!

I hoped there’d be more error output than just “exit status 1”. Can you try running the following command in /mnt/d/Projects/mytest.test:

/usr/bin/python3 -m venv .trellis/virtualenv

(might need to make sure /mnt/d/Projects/mytest.test/.trellis exists first)

Can you also run /usr/bin/python3 --version please?

Hopefully this should provide some more outputs and hints to troubleshoot.

1 Like


The issue was indeed related to the virtual environment not being created :

/usr/bin/python3 -m venv .trellis/virtualenv

The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt install python3.8-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/mnt/d/Projects/mytest.test/.trellis/virtualenv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

I ran a sudo apt install python3.8-venv to install the missing package and started all over again.

Now the trellis new mytest.test is working fine! Problem solved. Thank you!


Thanks for debugging! I’ll think about how to handle this better in the CLI or make it more obvious.