I was attempting to run the jupyter notebook from this Github page, which meant being able to run jupyter notebooks, as well as cloning the GitHub repository.

From the Jupyter Notebook installation page, I was told to download Continuum Anaconda. So I used the code on this page to install Anaconda on my machine for Python3:

wget https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
bash Anaconda3-4.2.0-Linux-x86_64.sh -b -p ~/anaconda
rm Anaconda3-4.2.0-Linux-x86_64.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc 
source .bashrc
conda update conda

Which seemed to work without issue. I was able to run Notebooks and run Python3 in the commandline.

I then downloaded the github repository with

wget https://github.com/jakeret/tf_unet/archive/master.zip

and opened the notebook from the downloaded directory. This worked fine, except that I couldn't run the from tf_unet install commands (I think the error message was "No module named tf_unet") which I assumed was because I hadn't actually run make on the repository.

At this stage, python and python3 ran fine on the commandline outside of the tf_unet directory, but when I tried to run python in the directory, I got this issue:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f81ead5d740 (most recent call first):
Aborted (core dumped)

I removed the repository, and cloned it from GitHub with git clone https://github.com/jakeret/tf_unet

Following the instructions in ./docs/installation.rst I ran the following commands:

pip install -r requirements.txt
pip install tensorflow
python setup.py install --user

pip install tensorflow was unnecessary as the Anaconda installation included tensorflow. python setup.py install --user failed with the same error as before ("Unable to locale encoding")

Following the instructions on a similar AskUbuntu question (I can't add any more links due to reputation) I tried unsetting the PYTHONPATH (unset PYTHONPATH) which didn't work. I also tried a StackOverflow thread that suggested running

rm -rf venv
virtualenv -p /usr/bin/python3 venv/
source env/bin/activate

Which didn't work as the virtualenv failed for the same reason the other python commands did.

At this point I moved back out of the tf_unet directory and realised that python and python3 commands no longer work regardless of working directory.

This is where I am so far. Any advice on how to return to being able to use python on my machine (Ubuntu Server 14.04.4 LTS) that would be greatly appreciated. Any advice on returning to being able to use python AND being able to use tf_unet would be amazing.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.