1

I was trying to create a virtualenv on my vagrant centos7 with python3 and the following happens. Is there anything I can do with it? The version of virtualenv is 13.1.2 and python is 3.5.1. Thanks.

$ virtualenv -p python3 venv
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/virtualenv.py", line 2363, in <module>
    main()
  File "/usr/local/lib/python3.5/site-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/usr/local/lib/python3.5/site-packages/virtualenv.py", line 994, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python3.5/site-packages/virtualenv.py", line 1192, in install_python
    copy_required_modules(home_dir, symlink)
  File "/usr/local/lib/python3.5/site-packages/virtualenv.py", line 1131, in copy_required_modules
    copyfile(filename, dst_filename, symlink)
  File "/usr/local/lib/python3.5/site-packages/virtualenv.py", line 468, in copyfile
    os.makedirs(os.path.dirname(dest))
  File "/usr/local/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: 'venv/lib/python3.5/lib-dynload'
4
  • 1
    It looks like you already have a (possibly broken) virtualenv venv in that directory, and virtualenv doesn't overwrite existing files by default. Try removing it (rm -rf venv) and running the creation command again, or using the --clear switch for virtualenv. Commented Dec 29, 2015 at 15:14
  • I tried to delete and create the venv a few times and it is still not working even with the --clear. Is there any way to fix the broken virtualenv? I tried to reinstall it with pip but not working too. Or I should just reinstall the whole centos to save the time. Commented Dec 30, 2015 at 7:10
  • If you are trying to create the virtualenv inside a synced folder, it might be a problem with symlinks not being created correctly, as in this question. Commented Dec 30, 2015 at 9:46
  • yes, it works fine if not in the shared folder. Even though it is the perfect solution, I will just build the venv outside of the shared folder. However, I find another problem when trying to install djangocms-installer(setuptools must be installed to install from a source distribution ) but it is a different problem so I will consider this problem as solved. Thanks. Commented Dec 31, 2015 at 4:20

2 Answers 2

3

You probably have already a venv, try to delete it with

rm -rf yourPath/venv

and for create a new one

python3 -m venv pathToCreateNewVenv
Sign up to request clarification or add additional context in comments.

Comments

1

It is probably the problems with symbolic link at shared folder. I solved it by simply create the venv outside of the shared folder.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.