Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Jupyter Notebook deployment on GIScript2016-Docker?

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces how the Jupyter Notebook deployment on GIScript2016-Docker is, the content is very detailed, interested friends can use it for reference, I hope it can be helpful to you.

GIScript2016 is a geospatial data processing and analysis toolkit that supports Python3.

GIScript2016 supports Jupyter and Spark and can run on stand-alone machines as well as large clusters. GIScript with Jupyter+Spark on Docker this technology stack is very powerful, through the conda package manager can also install a large number of scientific computing packages, such as NumPy, Scikit, Pandas and OpenCV, NLTK, Tensorflow, Keras and other machine learning software packages, is really big data processing, analysis and in-depth research artifact.

GIScript2016 encapsulates the C++ system library into Python, which makes it easy for researchers to write their own professional algorithm library using C++, and then add it to this framework, which is an excellent reference for writing high-performance Python extension modules.

Let's take the method of deploying GIScript2016 in Docker, and then use Jupyter Notebook for browser-based access. Once the environment is set up, you can deploy Docker containers in many environments, which is very convenient to use. Jupyter Notebook is a browser-based programming "notebook", which is very suitable for data exploration research.

1. Install support Environment 1.1 install Docker Container support Environment

The Mac OS X I use is now natively supported by Docker, so you don't have to install VirtualBox and use Vagrant as before.

Go here to http://www.docker.io to download the appropriate version, and then run the installer, it will be fine.

If you use Ubuntu, it is recommended to use the script downloaded by http://get.docker.io for installation. The official installation method seems to conflict with the built-in lxd of Ubuntu, and there are often problems. The methods are as follows:

Wget http://get.docker.io-O docker-setup.shsudo chmod + x docker-setup.sh./docker-setup.sh1.2 install Jupyter Notebook Container

Uses Jupyter's official Docker technology stack.

Docker run-it-- name GISpark-p 9000 GRANT_SUDO=yes 8888-- user root-e GRANT_SUDO=yes-v / local directory / GISpark:/home/jovyan/work/GISpark jupyter/all-spark-notebook

If the Docker download is too slow, try to join the mirror library: https://pee6w651.mirror.aliyuncs.com

1.3 install and update software in the container

Open a browser and enter: http://localhost:9000.

Open a terminal window inside, run the upgrade program, and install the required software:

Sudo apt-get updatesudo apt-get upgradesudo apt-get install python3-dev2. Download and compile GIScript20162.1 download source code git clone https://git.oschina.net/GIScript/GIScript2016.git2.2 install SIP

Enter the SIP directory, enter 3dParty first, and run:

Python3 configure.pymake sudo make install2.3 compiles GIScript code

Return to the parent directory and run:

Python3 configure.py

Enter the Build directory and run:

Solving the problem of sudo make install2.4 compilation

Well, you didn't find it?

Go to the SIP/Build directory, open the GNUmake.opt file, and modify it as follows:

# Set python. If you don't#PY_LIB = "/ usr/lib/python3" # PY_INCLUDE = "/ usr/include/python3.5m" PY_LIB = "/ opt/conda/lib/python3.5" PY_INCLUDE = "/ opt/conda/include/python3.5m"

Run make again, and fatal error: X11/Xlib.h: No such file or directory appears again, presumably missing the support library for x11.

Install the development libraries for x11:

Sudo apt-get install libx11-dev

Run make again and compile.

3. Run the test

To run python3, enter:

From GIScript import GISCore

It shows that you can't find it. Go to / opt/conda/lib/python3.5/dist-packages and have a look. The files are all there.

3.1 install the GIScript library of Python

It is estimated that the permission, the path and so on have not been found. Try a different directory:

Cp GIScript.. / site-packages

Run it again, which succeeds this time, but prompts libSuBase.so: cannot open shared object file: No such file or directory. There are some basic dynamic libraries that can't be found, so you need to set the path of the UGC base library.

3.2Setting the access path of UGC dynamic library

Here you need to modify the file start.sh, which is set in the file / usr/local/bin/ directory when you start Jupyter. Copy it first, modify it, and then copy it back. Add content before:

# Add GIScript Library Path of UGC.export SUPERMAP_HOME=/home/jovyan/work/supermap/GIScript2016export LD_LIBRARY_PATH=$SUPERMAP_HOME/Bin64_Linux_gcc4_9:$LD_LIBRARY_PATH

Then restart docker.

Docker stop GISparkdocker start GISpark

Refer to here to set the path of the dynamic library. In addition to the above path, because Ubuntu14.04 is a little old, there are some versions of the system libraries that need to be updated.

The system library directory of the cd / opt/conda/lib # runtime environment, depending on the version. Mv libstdc++.so libstdc++.so.xmv libstdc++.so.6 libstdc++.so.6.xmv libsqlite3.so.0 libsqlite3.so.0.xmv libsqlite3.so libsqlite3.so.xmv libgomp.so.1.0.0 libgomp.so.1.0.0.xmv libgomp.so.1 libgomp.so.1.xmv libgomp.so libgomp.so.x3.3 run routine 3.3.1 Jupyter Notebookfrom GIScript import GISCoreprint (GISCore)

Help information for GISCore will be displayed and the system is configured successfully.

3.3.2 Spark Shellfrom GIScript import GISCorefrom GIScript import Datafrom pyspark import SparkConf, SparkContextAPP_NAME = "GeoTest For Spark" def main (sc): pnt = GISCore.Point2D (12.0 pnt 32.0) geo = Data.GeoPoint () b = geo.Make (pnt) br = sc.broadcast (geo) c = sc.parallelize (range 10) .map (lambda x:br.value.GetPoint ()) .collect () for i in c: print (I) sc.stop () if _ name__ = = "_ _ main__": # Configure Spark conf= SparkConf () .setMaster ("spark://master:7077") conf=con f.setAppName (APP_NAME) sc = SparkContext (conf=conf) main (sc) 3.3.3 get file information "# coding: utf-8import sysfrom GIScript import GISCore" Brief file path definition''strTiffPath = "Raster/astronaut (CMYK) _ 32.tif" if _ _ name__ = =' _ _ main__': try: fileParser = Conversion.FileParser () bOpen = fileParser.Open (strTiffPath) If bOpen: rasterInfo = fileParser.GetRasterInfo () nWidth = rasterInfo.GetWidth () nHeight = rasterInfo.GetHeight () pixelFormat = rasterInfo.GetPixelFormat () rc2Bounds = rasterInfo.GetBounds () nBandCount = rasterInfo.GetBandCount () nBlockSize = rasterInfo.GetBlockSize () strPrj = rasterInfo. GetProjection () dXRatio = rc2Bounds.Width () / nWidth dYRatio = rc2Bounds.Height () / nHeight colorset = rasterInfo.GetColorset () dMax = rasterInfo.GetMax () dMin = rasterInfo.GetMin () dNoValue = rasterInfo.GetNoValue () print ("= File basic Information =") print ("Picture width:" NWidth) print ("Picture height:", nHeight) print ("Pixel format:", pixelFormat) print ("Band number:", nBandCount) print ("Block size:", nBlockSize) print ("Block Storage data:", rasterInfo.GetIsTile ()) print ("Bound range (top left, bottom right): (", rc2Bounds.left, " ", rc2Bounds.top,", ", rc2Bounds.right,", ", rc2Bounds.bottom,") print ("X, Y Resolution:", dXRatio, dYRatio) print ("Color Table size:", len (colorset)) print ("maximum:", dMax) print ("minimum:" DMin) print ("No value:", dNoValue) if strPrj! = "": print ("projection:" StrPrj) else: print ("projection: plane coordinate system") print ("=") fileParser.Close () except SystemExit: raise except: sys.stderr.write ("An internal error occured.") Raise about the deployment of Jupyter Notebook on GIScript2016-Docker is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report