Table of Contents

Python Programming Related

This page hosts general information about python programming. For detailed packages, check the deligated pages. For example, Tensorflow Related.

Python environment management using conda

Miniconda Installation

We use conda to manage package and virtual environment. To learn about what is conda: https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html Also read the official ''conda'' documentations.

Check in your terminal if conda has been installed, if not, you can either ask me to install it, or install it by yourself following the guides below.

Installation guides:

Environment management:

PyCharm (IDE) Configurations

Conda, TensorFlow, LD_LIBRARY_PATH

Issue: Not setting environment parameters properly, so cannot find CUDA installation or some others

A workaround that uses just one line command and needs to manually configured for each environment:

# with the desired conda environment activated
conda env config vars set LD_LIBRARY_PATH=$CONDA_PREFIX/lib

(credits: a GitHub issue discussion) Conda official documents about setting environment variables.

This has been a known issue of PyCharm for quite a long time. (For example: PyCharm doesn't set LD_LIBRARY_PATH when running scripts)

This allows the terminal to find Tensorflow path correctly in the conda environment, but not PyCharm yet. See Configure PyCharm to run TensorFlow for additional settings.

Configure PyCharm to run TensorFlow

To use TensorFlow properly, LD_LIBRARY_PATH needs to be exposed to PyCharm properly. Within the correct conda env activated, find the correct path using:

echo $CONDA_PREFIX/lib

Then, add the output result as an environment variable LD_LIBRARY_PATH in PyCharm.