17

I am new to python and would like to install SocksIPy on Ubuntu (running within a VirtualBox vm). The README says to place the socks.py file into my lib/site-packages directory. I do not know where to locate this directory. The Terminal command python socks.py install from the root runs, but does not install correctly (error "No module named socks" when I run import socks in a python script)

SocksIPy link http://socksipy.sourceforge.net/

Can someone suggest a way to get socks/socksipy running on my machine? Thanks!

One
  • 69
  • 9
user1868039
  • 173
  • 1
  • 1
  • 5
  • See this answer: http://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory it will help you to find site-packages. – cleg Feb 11 '13 at 20:41

3 Answers3

19

The simplest way to install it - provided the VM has working Internect connectivity - would likely be to let apt-get do it for you. From a terminal:

sudo apt-get install python-socksipy

It's in the universe repository, which should be enabled by default. If not, you can enable it yourself.

Community
  • 1
  • 1
eldarerathis
  • 35,455
  • 10
  • 90
  • 93
  • Got it -- had tried this earlier and it broke...I think your syntax was 'more correct' than mine. Thanks! – user1868039 Feb 11 '13 at 22:35
  • How would I go about doing it with pip? say, if i want to do it only in virtualenv? `pip search socks` shows SocksiPy as an existing package, but pip install SocksiPy fails. – eran Dec 03 '13 at 16:36
  • 3
    @eran you can try `pip install SocksiPy-branch` – Anshul Apr 23 '14 at 09:34
  • @Anshul: `SocksiPy-branch` seems broken e.g., [stem tutorial](https://stem.torproject.org/tutorials/to_russia_with_love.html) works with `python-socksipy` but [breaks with `SocksiPy-branch` due to stack overflow in `sendall()`](http://stackoverflow.com/q/28790000/4279). – jfs Mar 01 '15 at 12:05
  • @J.F.Sebastian, Ohk. Thanks for the update. I don't remember exactly why I used it in first place but worked fine for my limited use case of a prototype back then. – Anshul Mar 02 '15 at 11:09
  • The solution in the other answer from @J.F.Sebastian works better in a virtualenv – theheadofabroom Jul 11 '16 at 10:26
17

PySocks is yet another SocksiPy fork:

$ pip install PySocks

It works on Python 2/3.

jfs
  • 399,953
  • 195
  • 994
  • 1,670
1

For Python3

$ sudo apt-get install python3-socks
Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57