TransWikia.com

What is my shell environement?

Unix & Linux Asked by MikiBelavista on December 21, 2021

I decided to post here because my problem deals with Linux issues. I am trying to run Jupiter notebook

from pyspark.sql import SparkSession
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-13-61fbc0d156c2> in <module>
----> 1 from pyspark.sql import SparkSession

ModuleNotFoundError: No module named 'pyspark'

In Jupyter,shell environment and Python executable are disconnected.

!echo $PATH
/snap/jupyter/6/bin:/snap/jupyter/6/usr/sbin:/snap/jupyter/6/usr/bin:/snap/jupyter/6/sbin:/snap/jupyter/6/bin:/home/mm/snap/jupyter/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

ANd

sys.path['/home/mm',
 '/snap/jupyter/6/lib/python37.zip',
 '/snap/jupyter/6/lib/python3.7',
 '/snap/jupyter/6/lib/python3.7/lib-dynload',
 '',
 '/snap/jupyter/6/lib/python3.7/site-packages',
 '/snap/jupyter/6/lib/python3.7/site-packages/IPython/extensions',
 '/home/mm/snap/jupyter/6/.ipython']

IF I list packages

!pip list
Package Version
------- -------
py4j    0.10.9 
pyspark 3.0.0  

WHAT IS MY SHELL ENVIRONMENT?

One Answer

To get the shell that you are using:

Default shell:

echo $SHELL

Your current shell which may or may not be the same as the default:

echo $0

Two other ways to get your current shell:

ps -p $$

printf "%sn" $0

If you want to find all environment varilables, use either of the following two commands:

env

printenv

The issues that you are having with Jupyter Notebook are possibly due to the way that your Python environment is set up. You can use:

env | grep -i python

printenv | grep -i python

Answered by Nasir Riley on December 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP