[DOCKER] Install the python package in an offline environment

I want to bring a Python package to an offline environment with pip --Qiita http://qiita.com/ryozi_tn/items/d08edf86dba5e7806da8

Python: Install the Python package in an environment that does not communicate with the Internet (revised) --CUBE SUGAR CONTAINER http://blog.amedama.jp/entry/2016/06/02/223808

Both of them did not work well, so I will leave the result of trial and error. As an example, let's try the procedure to install django. A docker container was used to emulate a clean environment and an offline environment. In the actual environment, you can download and install without root privileges, and you can keep the system area such as / usr clean.

Working in an online environment

--The docker container is for emulating a clean environment. --Allocate container host data area to container with -v option --I installed the pip command once. -Although it is saved in / data / src, it can be saved anywhere as it is carried by USB memory etc. in the actual environment.

$ docker run -v `pwd`/django:/data --rm -i -t centos:centos7 /bin/bash
# useradd ym
# su - ym
//Up to this point for emulated environments
$ cd /data
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py --user
$ pip download -d src pip setuptools wheel django
$ ll src/
-rw-rw-r-- 1 ym ym 6796229 Sep 17 16:00 Django-1.10.1-py2.py3-none-any.whl
-rw-rw-r-- 1 ym ym 1198961 Sep 17 15:59 pip-8.1.2-py2.py3-none-any.whl
-rw-rw-r-- 1 ym ym  465369 Sep 17 16:00 setuptools-27.2.0-py2.py3-none-any.whl
-rw-rw-r-- 1 ym ym   66878 Sep 17 16:00 wheel-0.29.0-py2.py3-none-any.whl
$ exit
# exit

Working in an offline environment

--You can emulate an environment that is not connected to an external network at all by adding the --net none option. --In the real environment, copy the data downloaded from the USB memory.

$ docker run -v `pwd`/django:/data --net none --rm -i -t centos:centos7 /bin/bash
# useradd ym
# su - ym
//Up to this point for emulated environments
$ cd /data
$ python get-pip.py --no-index --find-links src --user
$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ym/.local/bin:/home/ym/bin
$ pip -V
pip 8.1.2 from /home/ym/.local/lib/python2.7/site-packages (python 2.7)
$ pip install --no-index --find-links src --user django
$ python
Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.10.1'

reference

pip download — pip 8.1.2 documentation http://pip.readthedocs.io/en/stable/reference/pip_download/

pip install — pip 8.1.2 documentation http://pip.readthedocs.io/en/stable/reference/pip_install/

Find out which version of Python or Django you're using-Django Tips http://www.gesource.jp/programming/python/django/004.html

Recommended Posts

Install the python package in an offline environment
Install the package in an offline environment
Install python package in personal environment on Ubuntu
[For beginners] Install the package in the Anaconda environment (Janome)
Install scrapy in python anaconda environment
install tensorflow in anaconda + python3.5 environment
Install the Python module in any directory
Building an environment that uses Python in Eclipse
Install Python 3.5.1 + numpy + scipy + α in Windows environment
How to install python package in local environment as a general user
The 18th offline real-time writing problem in Python
virtual environment in python
Development environment in Python
The 19th offline real-time writing problem in Python
Install LightGBM in an OS X virtualenv environment
[Python] How to save the installed package and install it in a new environment at once Mac environment
A complete guidebook to using pyenv, pip and python in an offline environment
Build an interactive environment for machine learning in Python
Use the CASA Toolkit in your own Python environment
Quicksort an array in Python 3
Install Python environment with Anaconda
Download the file in Python
Find the difference in Python
[Linux] Update the package offline
Handle environment variables in Python
Build a Python environment offline
Python install in 2 lines @Windows
I checked the Python package pre-installed in Google Cloud Dataflow
Check the operation of Python for .NET in each environment
Commands often used in the development environment during Python implementation
After enabling the python virtual environment in the batch file, run the python file
Install CaboCha in Ubuntu environment and call it with Python.
I tried running the offline speech recognition system Julius with python in the Docker virtual environment
Getting the arXiv API in Python
Python in the browser: Brython's recommendation
Save the binary file in Python
Hit the Sesami API in Python
Install python2.7 on windows 32bit environment
Studying Python Part.1 Creating an environment
Get the desktop path in Python
Write an HTTP / 2 server in Python
Bayesian optimization package GPyOpt in Python
Get the script path in Python
In the python command python points to python3.8
Develop an investment algorithm in Python 2
Implement the Singleton pattern in Python
Windows10: Install MeCab library in python
Install the Python plugin with Netbeans 8.0.2
Hit the web API in Python
I can't install scikit-learn in Python
I wrote the queue in Python
Calculate the previous month in Python
Examine the object's class in python
Install Python development environment on Windows 10
Get the desktop path in Python
Get the host name in Python
Checking the NAOqi Python development environment
Python in is also an operator
Access the Twitter API in Python
Docker environment update: add Python package
The first step in Python Matplotlib