allegro / allegro/ralph

ExitCodeException exitCode=134: Fatal Python error: Py_Initialize: Unable to get the locale encoding

Open
#3,565 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.5k
Forks
593
Avg merge
2d 9h
Merged PRs (30d)
6

Description

### Steps to reproduce
Hello, I am getting following error while using Jupyter notebook:

```
Install jupyter and launch notebook:
-hdp ~]$ /opt/anaconda3/bin/jupyter notebook
.......
[I 11:40:05.457 NotebookApp] The Jupyter Notebook is running at: http://usdfwxx.com:8888/
..........
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f55e7053740 (most recent call first):
ls: cannot access /usr/hdp//hadoop/lib: No such file or directory
......
ExitCodeException exitCode=134: Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f45a6104740 (most recent call first):
```

I already tried following but didn't help:

1. exporting environment variables in my user's bash profile.
2. tried updating Py4j version to py4j-0.10.9-src.zip in '/usr/hdp/current/spark2-client//python/lib'
3. updating python version to 3.6 and then 3.7 and pointing '/opt/anaconda3/bin/python3 -> /usr/local/bin/python3.7'
and /opt/anaconda3/bin/python3 -> python3.5
4. pip install findspark
pip install statsd
python3 -m pip install pyspark

Need your expert advise on this now.

### Expected behavior

There should not be any error

### Actual behavior

Attached screenshot:
![error1](https://user-images.githubusercontent.com/31091290/94850529-aeb02a00-0444-11eb-84cf-ccb15c3515ea.JPG)
![error2](https://user-images.githubusercontent.com/31091290/94850561-b7a0fb80-0444-11eb-8de3-812b6521052f.JPG)

### Environment

-hdp ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 (Maipo)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.