Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/4897#discussion_r25988754
--- Diff: python/pyspark/context.py ---
@@ -710,6 +717,33 @@ def addPyFile(self, path):
# for tests in local mode
sys.path.insert(1, os.path.join(SparkFiles.getRootDirectory(),
filename))
+ def addRequirementsFile(self, path):
+ """
+ Add a pip requirements file to distribute dependencies for all
tasks
+ on thie SparkContext in the future. An ImportError will be thrown
if
+ a module in the file can't be downloaded.
+ See
https://pip.pypa.io/en/latest/user_guide.html#requirements-files
+ """
+ import importlib
+ import pip
+ import tarfile
+ import tempfile
+ import uuid
+ tar_dir = tempfile.mkdtemp()
+ try:
+ for req in pip.req.parse_requirements(path,
session=uuid.uuid1()):
+ if not req.check_if_exists():
+ pip.main(['install', req.req.__str__()])
+ mod = importlib.import_module(req.name) # Can throw
ImportError
--- End diff --
import lib is not available in Python 2.6
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]