How do I use external libraries with virtualenv?

I am trying to figure out how to use external libraries. I have a program that runs successfully on Spark and now I am trying to import external libraries. I use virtualenv

, and every time I submit it, it complains that it cannot find the file.

Here's one of the many send commands I've tried:

/path/to/spark-1.1.0-bin-hadoop2.4/bin/spark-submit --py-files `pwd`/venv/lib/python2.7/site-packages


I tried to add files separately with a flag --py-files

, I also tried the following subdirectories.



They all throw the following error:

ImportError: ('No module named <module>', <function subimport at 0x7f287255dc80>, (<module>,))



I have also tried copying these files to the directory pyspark

with no success.


source to share

1 answer

When you create virtual env go --system-site-packages

to virtualenv


virtualenv --system-site-packages venv


If you forgot to skip this option:

rm venv/lib/python2.7/no-global-site-packages.txt


In both directions you can import system-site-packages

in virtual env.



All Articles