0
votes

I installed virtualenv on fedora 26 using pip3 install --user virtualenv.
System has both python 2.7 and python 3.6.
When I am creating a "virtualenv venv", I am getting this output and error.

New python executable in /home/asraisingh/venv/bin/python2
Also creating executable in /home/asraisingh/venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /home/asraisingh/venv/bin/python2 - setuptools pip wheel:
Traceback (most recent call last):
File "", line 7, in
File "/home/asraisingh/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/init.py", line 7, in
File "/usr/lib64/python2.7/optparse.py", line 77, in
import textwrap
File "/usr/lib64/python2.7/textwrap.py", line 10, in
import string, re

File "string.py", line 1 KDE: 9
^
SyntaxError: invalid syntax
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/home/asraisingh/.local/bin/virtualenv", line 11, in
sys.exit(main())
File "/home/asraisingh/.local/lib/python2.7/site-packages/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/home/asraisingh/.local/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
download=download,
File "/home/asraisingh/.local/lib/python2.7/site-packages/virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/home/asraisingh/.local/lib/python2.7/site-packages/virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/asraisingh/venv/bin/python2 - setuptools pip wheel failed with error code 1

1
Check if you have a file string.py in your current working directory.Mike Müller
Yes, I have string.py in my current working directory.asraisingh
Thanks just renamed the string.py and it worked.asraisingh
Great. Made my comment an answer. You can accept an answer if it solves your problem.Mike Müller

1 Answers

1
votes

Check if you have a file named string.py in your current working directory. If so, rename, move, or delete it. This should solve your problem.