RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1306513 - python-virtualenv-1.10.1-2.el7: os.py:157:makedirs:OSError: [Errno 20] Not a directory: 'ansible/lib'
Summary: python-virtualenv-1.10.1-2.el7: os.py:157:makedirs:OSError: [Errno 20] Not a ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-virtualenv
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Tomas Orsava
QA Contact: David Jež
URL:
Whiteboard:
Depends On:
Blocks: 1305230
TreeView+ depends on / blocked
 
Reported: 2016-02-11 06:06 UTC by Manish Saxena
Modified: 2019-12-16 05:22 UTC (History)
7 users (show)

Fixed In Version: python-virtualenv-1.10.1-3.el7
Doc Type: Enhancement
Doc Text:
Feature: Added an error message when virtual env is passed a FILE that already exists and is not a directory. Reason: It's better to show a custom error message instead of a traceback. Result: Error message is displayed when appropriate.
Clone Of:
: 1353200 1353202 1353205 1353206 1353960 1357432 (view as bug list)
Environment:
Last Closed: 2016-11-04 04:39:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Polish error message of when file is passed (842 bytes, patch)
2016-03-10 09:09 UTC, Robert Kuska
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2360 0 normal SHIPPED_LIVE python-virtualenv bug fix update 2016-11-03 13:49:24 UTC

Description Manish Saxena 2016-02-11 06:06:37 UTC
Description of problem:

[abrt] python-virtualenv-1.10.1-2.el7: os.py:157:makedirs:OSError: [Errno 20] Not a directory: 'ansible/lib'

time:           Wed 27 Jan 2016 01:28:16 PM EST
cmdline:        /usr/bin/python /usr/bin/virtualenv ansible
uid:            13009 (yundtj)
abrt_version:   2.1.11
comment:        I created a virtualenv and installed ansible.
dso_list:       python-libs-2.7.5-34.el7.x86_64
event_log:      
executable:     /usr/bin/virtualenv
kernel:         3.10.0-327.4.5.el7.x86_64
last_occurrence: 1453919296
pid:            15884
pkg_arch:       noarch
pkg_epoch:      0
pkg_name:       python-virtualenv
pkg_release:    2.el7
pkg_version:    1.10.1
runlevel:       N 5
username:       yundtj

sosreport.tar.xz: Binary file, 17901444 bytes

backtrace:
:os.py:157:makedirs:OSError: [Errno 20] Not a directory: 'ansible/lib'
:
: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'
:
:Local variables in innermost frame:
:tail: 'lib'
:head: 'ansible'
:name: 'ansible/lib'
:mode: 511

environ:
:force_s3tc_enable=true
:SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
:GNOME_DESKTOP_SESSION_ID=this-is-deprecated
:GJS_DEBUG_OUTPUT=stderr
:WINDOWPATH=1
:LESSOPEN=||/usr/bin/lesspipe.sh %s
:QT_IM_MODULE=ibus
:LOGNAME=yundtj
:USER=yundtj
:PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/acct.upmchs.net/yundtj/.local/bin:/home/acct.upmchs.net/yundtj/bin
:XDG_VTNR=1
:QTDIR=/usr/lib64/qt-3.3
:GUESTFISH_RESTORE=\e[0m
:GUESTFISH_INIT=\e[1;34m
:XDG_SESSION_DESKTOP=gnome
:LANG=en_US.UTF-8
:QTLIB=/usr/lib64/qt-3.3/lib
:TERM=xterm-256color
:SHELL=/bin/bash
:XAUTHORITY=/run/gdm/auth-for-yundtj-1s0K3t/database
:SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/14677,unix/unix:/tmp/.ICE-unix/14677
:QTINC=/usr/lib64/qt-3.3/include
:HISTSIZE=1000
:WINDOWID=35651591
:QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
:IMSETTINGS_INTEGRATE_DESKTOP=yes
:GPG_AGENT_INFO=/run/user/13009/keyring/gpg:0:1
:HOME=/home/acct.upmchs.net/yundtj
:USERNAME=yundtj
:IMSETTINGS_MODULE=none
:XDG_RUNTIME_DIR=/run/user/13009
:GUESTFISH_PS1=\[\e[1;32m\]><fs>\[\e[0;31m\] 
:SSH_AUTH_SOCK=/run/user/13009/keyring/ssh
:VTE_VERSION=3803
:GDMSESSION=gnome
:XMODIFIERS=@im=ibus
:MAIL=/var/spool/mail/yundtj
:QT_GRAPHICSSYSTEM_CHECKED=1
:XDG_CURRENT_DESKTOP=GNOME
:XDG_SESSION_ID=1
:DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-RW7M3Qul3X,guid=95a90d9c743a1b3e4761880156a7849e
:_=/usr/bin/virtualenv
:KDEDIRS=/usr
:DESKTOP_SESSION=gnome
:JAVA_HOME=/usr/lib/jvm/java-openjdk
:DISPLAY=:0
:GUESTFISH_OUTPUT=\e[0m
:KRB5CCNAME=KEYRING:persistent:13009
:HOSTNAME=etg61tfp
:GDM_LANG=en_US.UTF-8
:HISTCONTROL=ignoredups
:SHLVL=2
:PWD=/home/acct.upmchs.net/yundtj
:XDG_MENU_PREFIX=gnome-
:LS_COLORS=rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:
:GJS_DEBUG_TOPICS=JS ERROR;JS LOG
:XDG_SEAT=seat0

machineid:
:systemd=3506ae1de2b34f359c35b5477634cd20
:sosreport_uploader-dmidecode=039aaf85bb8014cbf57f9ee4c6367d8678b217f7741c8e4924db220a4e22ab05

reported_to:
:uReport: BTHASH=2167f9e07701bfc3532c4966bf2faaf5b5443e10
:ABRT Server: URL=https://api.access.redhat.com/rs/telemetry/abrt/reports/bthash/2167f9e07701bfc3532c4966bf2faaf5b5443e10

Version-Release number of selected component (if applicable):
RHEL7.2
python-virtualenv-1.10.1-2.el7

How reproducible:
Everytime

Steps to Reproduce:

To create virtual environments, we can use the virtualenv command. Create an environment called "testredhat" successfully.

[root@debug ~]# virtualenv testredhat
New python executable in testredhat/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
[root@debug ~]# cd testredhat/
[root@debug testredhat]# ls
bin  include  lib  lib64
[root@debug testredhat]# 

However if we create a file with similar name which we want to create for virtualenv then it throws an error. 

[root@debug ~]# 
[root@debug ~]# touch ansible
[root@debug ~]# rpm -qa | grep python-libs
python-libs-2.7.5-34.el7.x86_64
[root@debug ~]# 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@debug ~]# echo $?
1
[root@debug ~]# 

Actual results:

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

Expected results:

No error

Additional info:

Comment 2 Robert Kuska 2016-03-10 09:06:06 UTC
The behavior is correct but error message needs polishing.

Does this seem ok to you?

> $ touch ansible
> $ virtualenv scripts
ERROR: File already exists and is not a directory.
Please provide a different path or delete the file.

Comment 3 Robert Kuska 2016-03-10 09:09:45 UTC
Created attachment 1134762 [details]
Polish error message of when file is passed

Attaching patch which fixes the issue.

Comment 11 errata-xmlrpc 2016-11-04 04:39:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2360.html


Note You need to log in before you can comment on or make changes to this bug.