Randy Banks
Randy Banks

Reputation: 371

ImportError: No module named socketserver

Disclaimer: noob

I am trying to get streamparse (https://github.com/Parsely/streamparse) up and running on my machine. I am following the tutorial found here: https://youtu.be/ja4Qj9-l6WQ?t=18m50s . I have installed leiningen and pip, but when running the command

sparse quickstart

I get the error:

Randalls-MacBook-Pro:streamparse randallbanks$ sparse quickstart
Traceback (most recent call last):
File "/usr/local/bin/sparse", line 9, in <module>
load_entry_point('streamparse==1.1.0', 'console_scripts', 'sparse')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/streamparse/__init__.py", line 11, in <module>
import streamparse.cmdln
File "/Library/Python/2.7/site-packages/streamparse/cmdln.py", line 6, in <module>
from .ext.invoke import (list_topologies, kill_topology, run_local_topology,
File "/Library/Python/2.7/site-packages/streamparse/ext/invoke.py", line 25, in <module>
from ..contextmanagers import ssh_tunnel
File "/Library/Python/2.7/site-packages/streamparse/contextmanagers.py", line 8, in <module>
from six.moves.socketserver import UDPServer, TCPServer
ImportError: No module named socketserver

From what I've read, this seems like an issue with the name "socketserver" differing between python2 and python3. I've tried downloading python3 to see if this remedies the issue, but I keep running into this brew error:

Randalls-MacBook-Pro:streamparse randallbanks$ sudo brew install python3
Password:
Error: Cowardly refusing to `sudo brew install`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

Without 'sudo':

Randalls-MacBook-Pro:streamparse randallbanks$ brew install python3
Error: You must `brew link gdbm' before python3 can be installed
Randalls-MacBook-Pro:streamparse randallbanks$ brew link gdbm
Linking /usr/local/Cellar/gdbm/1.11... 
Error: Could not symlink include/gdbm.h
/usr/local/include is not writable.

it seems like workarounds for this error are 'not recommended'. I tried manually downloading python3 from the website https://www.python.org/downloads/mac-osx/ , but I don't really know what I'm doing as far as installing with all of these source files. Any help for the best direction I should take for resolving this issue would be greatly appreciated!

Upvotes: 0

Views: 6168

Answers (2)

Dan Blanchard
Dan Blanchard

Reputation: 111

The issue is that you're using the system installation of Python, which comes with a version of six (1.4.1) that is too old for streamparse.

As I put in the GitHub issue, I'd recommend that most people just use Anaconda if they're doing Python development on OS X to avoid the issues of trying to upgrade things in the system Python installation.

Upvotes: 0

Martijn Pieters
Martijn Pieters

Reputation: 1122342

OS X 10.10 comes with a pre-installed version of six that is too old to support sparse.

Your best option is to create a virtualenv and install sparse into that. A newer version of six will be installed into that virtualenv when you do.

Don't try to upgrade the version provided by Apple as that may break other things.

Upvotes: 2

Related Questions