You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by "Pagliari, Roberto" <rp...@appcomsci.com> on 2014/11/07 17:15:33 UTC

error when importing HiveContext

I'm getting this error when importing hive context

>>> from pyspark.sql import HiveContext
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path/spark-1.1.0/python/pyspark/__init__.py", line 63, in <module>
    from pyspark.context import SparkContext
  File "/path/spark-1.1.0/python/pyspark/context.py", line 30, in <module>
    from pyspark.java_gateway import launch_gateway
  File "/path/spark-1.1.0/python/pyspark/java_gateway.py", line 26, in <module>
    from py4j.java_gateway import java_import, JavaGateway, GatewayClient
ImportError: No module named py4j.java_gateway

I cannot find py4j on my system. Where is it?

Re: error when importing HiveContext

Posted by Davies Liu <da...@databricks.com>.
bin/pyspark will setup the PYTHONPATH of py4j for you, or you need to
setup it by yourself.

export PYTHONPATH=$SPARK_HOME/python/lib/py4j-0.8.2.1-src.zip

On Fri, Nov 7, 2014 at 8:15 AM, Pagliari, Roberto
<rp...@appcomsci.com> wrote:
> I’m getting this error when importing hive context
>
>
>
>>>> from pyspark.sql import HiveContext
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
>   File "/path/spark-1.1.0/python/pyspark/__init__.py", line 63, in <module>
>
>     from pyspark.context import SparkContext
>
>   File "/path/spark-1.1.0/python/pyspark/context.py", line 30, in <module>
>
>     from pyspark.java_gateway import launch_gateway
>
>   File "/path/spark-1.1.0/python/pyspark/java_gateway.py", line 26, in
> <module>
>
>     from py4j.java_gateway import java_import, JavaGateway, GatewayClient
>
> ImportError: No module named py4j.java_gateway
>
>
>
> I cannot find py4j on my system. Where is it?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org