makedirs OSError [Errno 20] Not a directory 'ansible/lib'

Solution Verified - Updated -

Issue

  • To create virtual environments, one use the virtualenv command. Create an environment called "testredhat" successfully.
[root@test ~]# virtualenv testredhat
New python executable in testredhat/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
[root@test ~]# cd testredhat/
[root@test testredhat]# ls
bin  include  lib  lib64
[root@test testredhat]# 
  • However if one create a file with similar environment name then it throws an error.
[root@test ~]# 
[root@test ~]# touch ansible
[root@test ~]# rpm -qa | grep python-libs
python-libs-2.7.5-34.el7.x86_64
[root@test ~]# virtualenv ansible
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 3, in <module>
    virtualenv.main()
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 821, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 956, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1129, in install_python
    mkdir(lib_dir)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 441, in mkdir
    os.makedirs(path)
  File "/usr/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 20] Not a directory: 'ansible/lib'
[root@test ~]# echo $?
1
[root@test ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[root@test ~]# rpm -qa | grep python-virtual
python-virtualenv-1.10.1-2.el7.noarch
[root@test ~]#

Environment

  • Red Hat Enterprise Linux 7.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.