protocol error setting up virtualenvironment through vagrant on ubuntu
Asked Answered
C

7

20

I'm trying to set up a virtualenv on Ubuntu 12.04 with Python 2.7 using vagrant but having same issues. it seems like this issues is seen only when "vagrant up" is issued from windows. what is the solution? any pointers?

New python executable in .vagrant-env/bin/python
  Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.11.6', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 824, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 984, in   create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1404, in install_python
    os.symlink(py_executable_base, full_pth)
   OSError: [Errno 71] Protocol error
Cure answered 8/7, 2014 at 20:4 Comment(3)
seems like its related to this .. but i can't find the answer to solve this issue #5907859Cure
Has anybody tried solving it with pythonbrew? if so how ?Cure
Did you get this fixed?Marcel
B
34

The solution is to use --always-copy. See here for the gory details.

Bosh answered 29/10, 2014 at 17:58 Comment(0)
T
19

This error can be fixed if you create the virtual env outside the /vagrant/ shared folder...

If go to the home folder of your vagrant user, you can create the virtualenv in there without this problem!

Just the venv must be out of this /vagrant/ directory... after that you can go work as usually activating this venv and working with your sorce code in the usual /vagrat/ shared dir...

Tent answered 4/10, 2014 at 14:47 Comment(0)
Z
18

I found the issue and fixed it. Just start your git bash/cmd prompt console as an administrator. Then, vagrant up > setup your virtual env. It should be a cake walk.

Thanks Venkat

Zomba answered 5/12, 2014 at 7:59 Comment(2)
This is the root of the problem.Inerney
(sorry for the bumping of a 6-year-old post) I believe this is also the solution for other ways to setup a venv (notably python3 -m venv venv)Underdeveloped
F
3

Use this

virtualenv --python= <#Python path for specific version#> <#Folder name#> --always-copy

Example:

virtualenv --python=/usr/local/bin/python3.7 venv --always-copy

Fouquiertinville answered 17/4, 2019 at 9:55 Comment(0)
E
0

I have had a similar problem. Just restarting the vagrant box was enough to solve it.

Eclat answered 9/11, 2016 at 13:0 Comment(0)
M
0
virtualenv venv --python=python3
Morceau answered 7/11, 2023 at 17:0 Comment(1)
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.Crackle
T
-2

This worked for me:

sudo virtualenv venv

Tussle answered 28/11, 2015 at 17:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.