# Python venv, Error " Ansible could not initialize the preferred locale "

**URL:** <https://forum.ansible.com/t/python-venv-error-ansible-could-not-initialize-the-preferred-locale/37492>\
**Category:** Ansible Project\
**Created:** [December 22, 2022, 11:03pm UTC](https://forum.ansible.com/t/python-venv-error-ansible-could-not-initialize-the-preferred-locale/37492 "2022-12-22T23:03:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Por](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@Por](https://forum.ansible.com/u/Por)\
**Post date:** [December 22, 2022, 11:03pm UTC](https://forum.ansible.com/t/python-venv-error-ansible-could-not-initialize-the-preferred-locale/37492/1 "2022-12-22T23:03:18Z")

</div>

Hi, is there who is like me?

I’ve tried

```shell
python3 -m venv venv

# and activate it
# then

pip install ansible
# pip in virtualenv not seems to support "--user" option

# run ansible
ansible

```

```shell
# error
"Ansible could not initialize the preferred locale: unsupported locale setting"

```

Anyone encounted the same?

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [December 23, 2022, 3:53am UTC](https://forum.ansible.com/t/python-venv-error-ansible-could-not-initialize-the-preferred-locale/37492/2 "2022-12-23T03:53:52Z")

</div>

Activating venv environments is a bit of a \*\*\*\*shoot, if you're been  
getting clever or cute with your PATH. I don't recommend using it.

Instead, urge using this:

&nbsp;&nbsp;&nbsp;&nbsp;pip3 install ansible-core --user

Note the use of the "--user" option, which puts things fairly  
consistently in $HOME/.local and as part of your default PATH. No  
additional "activate" step needed.

Also, don't install ansible. Only install ansible-core, and install  
modules from 'ansible collections' only if and as needed. Your setup  
will be \*much, much, much\* smaller and more stable, because the  
updates of individual and non-backwards compatible modules from the  
ansible collection is an unpredictable hazard if you install the  
"ansible" suite of more than 100 distinct modules written by many  
quite independent companies nad developers.

Nico Kadel-Garcia
