[PYTHON] Use tensorflow in an environment without root

A note of points that get stuck when you try to use tensorflow in an environment where you do not have root privileges. The environment is CentOS 6.7, but I think it's the same everywhere. I don't use CUDA.

Python version

It will not work unless 2.7 series is included. I used pyenv. Please see here. However, at that time, you need to specify the option as shown in here. By the way, if you put it in with pip without options, you need to re-install the library. Re-inserted numpy, sympy, tensorflow.

About glibc, libstdc ++ version

Since I am using a compiled binary, I cannot use it unless the libc version matches. So download the rpm and replace it. It seems that there is nothing like packages.debian.org on CentOS, so pull it out directly from the repository. I will come. For example, for RIKEN, go to here.

python


$ mkdir ~/tflib
$ cd ~/tflib
$ wget http://ftp.riken.jp/Linux/centos/7/os/x86_64/Packages/glibc-2.17-78.el7.x86_64.rpm
$ rpm2cpio glibc-2.17-78.el7.x86_64.rpm|cpio -idv
$ wget http://ftp.riken.jp/Linux/centos/7/os/x86_64/Packages/libstdc++-4.8.3-9.el7.x86_64.rpm
$ rpm2cpio libstdc++-4.8.3-9.el7.x86_64.rpm|cpio -idv

I will leave it as. If it is Debian / Ubuntu, you should find it appropriately and unzip it. [^ 1] [^ 1]: Maybe there is a dependency, but it worked without anything else. For Debian / Ubuntu, you can see dependencies in packages.debian.org, so please add them as appropriate. Now that I have everything, but the version of ld-linux.so doesn't match, so I'm afraid.

python


$ LD_LIBRARY_PATH=~/tflib/lib64/:~/tflib/usr/lib64/ ~/tflib/lib64/ld-2.17.so ~/.pyenv/versions/2.7.10/bin/python tutorial1.py

You can finally start it. I'm troublesome

~/.bashrc


alias tfpy='LD_LIBRARY_PATH=~/tflib/lib64/:~/tflib/usr/lib64/ ~/tflib/lib64/ld-2.17.so ~/.pyenv/versions/2.7.10/bin/python'

I left it as.

python


$ tfpy tutorial1.py

Supplement

Actually, I feel that maybe numpy or Python itself will have to be recompiled with the new libc. .. There are no errors so far.

Recommended Posts

Use tensorflow in an environment without root
Use Anaconda in pyenv environment
install tensorflow in anaconda + python3.5 environment
Use django-debug-toolbar in VirtualBox / Vagrant environment
Tips for importing macOS-optimized TensorFlow in an Apple M1 chip environment
Use cartopy without bugs in Google Colaboratory
How to use tensorflow under docker environment
Creating a virtual environment in an Anaconda environment
Install the package in an offline environment
Use WebDAV in a Portable Docker environment
Building an environment that uses Python in Eclipse
Use the latest pip in a virtualenv environment
Install the python package in an offline environment
Use Python in your environment from Win Automation
Use jupyter-lab installed in python virtual environment (venv)
Use Python in Anaconda environment with VS Code
[TF] How to build Tensorflow in Proxy environment
Use pydantic when reading environment variables in Python
Use os.getenv to get environment variables in Python
Install LightGBM in an OS X virtualenv environment
Use a free GPU in your favorite environment
Create an exe file that works in a Windows environment without Python with PyInstaller
Build an interactive environment for machine learning in Python
I want to use self in Backpropagation (tf.custom_gradient) (tensorflow)
Create an Anaconda virtual environment in your project folder
Procedure to install TensorFlow in fish shell environment (Anaconda 4.0.0)
Use the CASA Toolkit in your own Python environment
I tried running TensorFlow in AWS Lambda environment: Preparation
Use Sudachipy's learned word2vec in a low memory environment
Run pandas-highcharts display_charts in an environment other than jupyter
How to use jupyter lab in Windows 10 local environment
Building an environment to use CaboCha with google colaboratory
Use config.ini in Python
Use DataFrame in Java
Use dates in Python
Use Mean in DataFrame
Use Valgrind in Python
virtualenvwrapper in windows environment
Use ujson in requests
virtual environment in python
Use profiler in Python
Development environment in Python
Image normalization in TensorFlow
How to use VS Code in venv environment on windows
Resolve a Segmentation fault that occurs in Ubuntu 16.04+ Tensorflow environment
Use "% tensorflow_version 2.x" when using TPU with Tensorflow 2.1.0 in Colaboratory
pyenv, virtualenv Use docker to manage the environment without using
Use REST API in JIRA (user registration as an example)
Test discovery fails when using tensorflow in vscode + pytest environment
Print PDF in Python on Windows: Use an external application
Use Colab only as an external GPU environment (as of 2020.6 / Mac environment)