I get a Windows error when I try to use pip or easy_install inside virtualenvs. cygwin / python 2.7 / windows 7
*** error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
This error appears in other questions about SO, but they are all related to people trying to listen on port 80. In my case, I'm trying to connect to port 80/443 - which should not be almost as limited.
I can use pip with basic python, just not with one in virtualenv, so I don't think this is a library problem. The following is a test run performed in the console2 window with administrator privileges.
$ which python
/cygdrive/c/Python27/python
I can get to pypi here:
$ pip install
Downloading/unpacking django from https://pypi.python.org/packages/any/D/Dj....
ctl^c
virtualenv
1.11.4
creating virtualenv:
$ virtualenv testenv
New python executable in testenv\Scripts\python.exe
Installing setuptools, pip...done.
$ source testenv/Scripts/activate
virtualenv is really activated. (you can see that sys.path is different when starting a new python)
(testenv)$ which python
/cygdrive/c/proj/testenv/Scripts/python
(testenv)$ which pip
/cygdrive/c/proj/testenv/Scripts/pip
(testenv)$ pip --version
pip 1.5.4 from C:\proj\testenv\lib\site-packages (python 2.7)
(testenv)$ pip install django
Cannot fetch index base URL https://pypi.python.org/simple/
Put a breakpoint in c: \ python27 \ Lib \ socket.py: 576
(testenv)$ pip install django
the corresponding code is here in socket.py:
res=getaddrinfo(host, port, 0, SOCK_STREAM)
res
>>> [(2, 1, 0, '', ('103.245.222.184', 443))]
af, socktype, proto, canonname, sa = res[0]
sock = socket(af, socktype, proto)
sock
>>> <socket._socketobject object at 0x020505E0>
the socket is created normally.
sock.connect(sa)
*** error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
Failed to create socket library.
Since everything works, except for virtualenv, I think that somehow virtualenv is not creating python in the right direction, so windows do not give it enough permissions even to connect.
I do not have antivirus software, and the problem occurs even when the Windows Firewall is turned off.
Permissions: testenv, testenv / Scripts - 755. It is also python and all exes in scripts. Any ideas?