Can't find sphinx==1.8.1 for generating documentation

I hope this is the best category to place my question. I'm building Swift from the source, but it seems that build script can't find Sphinx package in my python installation.

I have system python and python installed from macports. I installed sphinx 1.8.1 using both distributions to no avail. Can anyone point me in the right directionon how to "fix" this?

This is the exact output of failing command:

cd /Users/eimantas/Development/swift-source/swift/docs && /usr/local/bin/sphinx-build -W -D latex_elements.papersize=letter -d /Users/eimantas/Development/swift-source/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/doctrees -b html . /Users/eimantas/Development/swift-source/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/docs/html
Traceback (most recent call last):
  File "/usr/local/bin/sphinx-build", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Users/eimantas/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3191, in <module>
    @_call_aside
  File "/Users/eimantas/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/Users/eimantas/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/Users/eimantas/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/Users/eimantas/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/eimantas/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Sphinx==1.8.1' distribution was not found and is required by the application