Jetson AGX Xavier Trampling Record

1. Upgrade all installation packages and update the system after networking

 sudo  apt-get update

2. Install Chinese Input Method

sudo  apt-get install fcitx-googlepinyin

3. Install nano text editor, preferring this text editor (no commands required). I used to like gedit, but last time in Jetson's linux, sudo gedit's interface refresh had problems, and I don't know why. But this time the system will not have this problem.

sudo  apt-get install nano

4. Install pip3

https://pypi.org/ Search for pip, my current latest version is 19.2.2

After clicking on the installation link, the official tells you to install with the following command:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

But curl is not available by default, so curl is installed first.

$ sudo apt-get install curl

5. Create a dowload folder in your home, execute the curl command, and download a file called get-pip.py.

6. Implement sudo Python 3 get-pip.py according to official requirements

$ sudo python3 get-pip.py
WARNING: The directory '/home/cpt/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/cpt/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading https://files.pythonhosted.org/packages/8d/07/f7d7ced2f97ca3098c16565efbe6b15fafcba53e8d9bdb431e09140514b0/pip-19.2.2-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 333kB/s 
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
     |████████████████████████████████| 583kB 8.6MB/s 
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
ERROR: launchpadlib 1.10.6 requires testresources, which is not installed.
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-19.2.2 setuptools-41.0.1 wheel-0.33.4
cpt@cie-jetson:~/download$ 

Although there is a red error line in the middle, the installation is successful. You can enter a pip3 in the terminal window and try it out.

7. Install Opencv

Jetpack already has its own opencv, but it's not successful when import ing in Python 3

$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
>>> 

It seems that you need to install Numpy. Before installing Numpy, let's look at our version of Opencv (Failure Method):

$ sudo pip3 show opencv-python
$ sudo pip3 show opencv-contrib-python 
$ sudo pip show opencv-python

After the above three commands, you can't get the version of opencv...

Search online for how to get it, and you can see it in python (note that python 2 is used here, because we have tried it, python 3 can not import cv2)

$ python
Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print cv2.__version__
3.3.1
>>> 

Click on this page through the official website: https://docs.opencv.org/4.1.1/da/df6/tutorial_py_table_of_contents_setup.html

Install Opencv in two ways according to the instructions

  • Install from pre-built binaries available in Ubuntu repositories
  • Compile from the source. In this section, we will see both.

As Xiaobai, I like the pre-built binaries approach. (Officially, sudo apt-get install python-opencv is installed, but my system will be used in Python 3, so make a slight change, otherwise it will be installed in Python 2 environment.)

$ sudo apt-get install python3-opencv

Officials say Opencv relies on Numpy:

Another important thing is the additional libraries required. OpenCV-Python requires only Numpy (in addition to other dependencies, which we will see later). But in this tutorials, we also use Matplotlib for some easy and nice plotting purposes (which I feel much better compared to OpenCV). Matplotlib is optional, but highly recommended. Similarly we will also see IPython, an Interactive Python Terminal, which is also highly recommended.

But we don't need to install any more, because numpy is installed automatically when Opencv is installed.

$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import numpy
>>> print (cv2.__version__)
3.2.0
>>> print (numpy.__version__)
1.13.3
>>> 

It seems that the version is not high, so it should not be upgraded first.

Try again to view the version with pip3:

$ sudo pip3 show numpy
Name: numpy
Version: 1.13.3
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: NumPy Developers
Author-email: numpy-discussion@python.org
License: BSD
Location: /usr/lib/python3/dist-packages
Requires: 
Required-by: uff
$ sudo pip3 show cv2
$ sudo pip3 show python3-opencv
$ 

It was found that pip3 was still unable to get the version of opencv. Maybe my instructions are wrong. I hope you can give me some advice.

8. Install Tensorflow

Open nvidia's official website nvidia.cn and pull it to the bottom:

Choose the developer -- download, and finally come to this URL page

https://developer.nvidia.com/embedded/downloads

Search for tensorflow

Install tensorflow as prompted by the latest version

(1) Install dependency Libraries

$ sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev

(2) upgrade pip3

$ sudo apt-get install python3-pip
$ sudo pip3 install -U pip

(3) Continue to install and upgrade dependency Libraries

$ sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta setuptools testresources

(4) On the official homepageDownload the tensorflow whl file (this file can be installed with Pip3)

(5) Install tensorflow. Note here that install is followed by the actual local path of the file you downloaded.

cpt@cie-jetson: sudo pip3 install ~/download/tensorflow_gpu-1.14.0+nv19.7-cp36-cp36m-linux_aarch64.whl

(6) Check whether the installation is successful (don't look at so much information, it doesn't matter, it doesn't affect our use):

$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2019-08-13 11:14:24.951197: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
>>> print (tf.__version__)
1.14.0
>>> 

So far, the development environment has been built.

 

Keywords: Python sudo pip OpenCV

Added by butsags on Tue, 13 Aug 2019 08:34:07 +0300