How to install numpy 、scikit-image、scikit-learn on Jetson TX2?

After install Jetpack4.2, pyrhon3.6.8、tensoflow==1.14.0、keras==2.3.1, errors occur when running :
Traceback (most recent call last):
File “predict_main.py”, line 2, in
import skimage.io
ModuleNotFoundError: No module named ‘skimage’

So,how to pip3 install skimage(scikit-image=0.15.0).By the way ,how to pip3 inatall the related packages such as numpy 、scikit-learn? Please tell me the correct answer,thank U.

1 Like

Hi,

Please try the following command:

sudo apt-get update
sudo apt-get install -y build-essential gfortran libatlas-base-dev
sudo pip3 install numpy cython sklearn

Thanks.

1 Like

when run the’sudo apt-get update’,some errors occur
root@tx2:~# sudo apt-get update
Reading package lists… Done
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
when run ‘sudo pip3 install numpy cython sklearn’
Building wheel for scikit-learn (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-66v2zn88/scikit-learn/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-66v2zn88/scikit-learn/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ bdist_wheel -d /tmp/pip-wheel-ukwj8g1x --python-tag cp36
cwd: /tmp/pip-install-66v2zn88/scikit-learn/
Complete output (28 lines):
Partial import of sklearn during the build process.
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-66v2zn88/scikit-learn/setup.py”, line 290, in
setup_package()
File “/tmp/pip-install-66v2zn88/scikit-learn/setup.py”, line 286, in setup_package
setup(**metadata)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/core.py”, line 137, in setup
config = configuration()
File “/tmp/pip-install-66v2zn88/scikit-learn/setup.py”, line 174, in configuration
config.add_subpackage(‘sklearn’)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py”, line 1036, in add_subpackage
caller_level = 2)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py”, line 1005, in get_subpackage
caller_level = caller_level + 1)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py”, line 942, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File “sklearn/setup.py”, line 62, in configuration
config.add_subpackage(‘utils’)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py”, line 1036, in add_subpackage
caller_level = 2)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py”, line 1005, in get_subpackage
caller_level = caller_level + 1)
File “/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py”, line 942, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File “sklearn/utils/setup.py”, line 8, in configuration
from Cython import Tempita
ModuleNotFoundError: No module named ‘Cython’

ERROR: Failed building wheel for scikit-learn
Running setup.py clean for scikit-learn
Successfully built cython sklearn
Failed to build scikit-learn
Installing collected packages: cython, joblib, scikit-learn, sklearn
Running setup.py install for scikit-learn … /^canceled
ERROR: Operation cancelled by user
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

so what should i do ?Please tell me !

pip3 list ,obviously scikit-learn has been installed sucessfully
root@tx2:~# pip3 list
Package Version


absl-py 0.8.0
apt-clone 0.2.1
apturl 0.5.2
asn1crypto 0.24.0
astor 0.8.0
beautifulsoup4 4.6.0
blinker 1.4
Brlapi 0.6.6
certifi 2018.1.18
chardet 3.0.4
cryptography 2.1.4
cupshelpers 1.0
cycler 0.10.0
Cython 0.29.14
decorator 4.1.2
defer 1.0.6
distro-info 0.18ubuntu0.18.04.1
feedparser 5.2.1
gast 0.3.2
google-pasta 0.1.7
graphsurgeon 0.4.1
grpcio 1.24.0
h5py 2.10.0
html5lib 0.999999999
httplib2 0.9.2
idna 2.6
joblib 0.14.0
Keras 2.3.1
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
keyring 10.6.0
keyrings.alt 3.0
kiwisolver 1.1.0
language-selector 0.1
launchpadlib 1.10.6
lazr.restfulclient 0.13.5
lazr.uri 1.0.3
louis 3.5.0
lxml 4.2.1
macaroonbakery 1.1.3
Mako 1.0.7
Markdown 3.1.1
MarkupSafe 1.0
mock 3.0.5
numpy 1.16.4
oauth 1.0.1
oauthlib 2.0.6
olefile 0.45.1
PAM 0.4.2
Pillow 5.1.0
pip 19.2.3
portpicker 1.3.1
protobuf 3.9.2
psutil 5.6.3
py-cpuinfo 5.0.0
pycairo 1.16.2
pycrypto 2.6.1
pycups 1.9.73
pygobject 3.26.1
PyICU 1.9.8
PyJWT 1.5.3
pymacaroons 0.13.0
PyNaCl 1.1.2
pyparsing 2.4.2
pyRFC3339 1.0
python-apt 1.6.4
python-dateutil 2.6.1
python-debian 0.1.32
pytz 2018.3
pyxdg 0.25
PyYAML 3.12
requests 2.22.0
requests-unixsocket 0.1.5
scikit-learn 0.21.3
scipy 0.19.1
SecretStorage 2.3.1
setuptools 41.4.0
simplejson 3.13.2
six 1.12.0
sklearn 0.0
ssh-import-id 5.7
system-service 0.3
systemd-python 234
tensorboard 1.14.0
tensorflow-estimator 1.14.0
tensorflow-gpu 1.14.0+nv19.7
tensorrt 5.1.6.1
termcolor 1.1.0
ubuntu-drivers-common 0.0.0
uff 0.6.3
unity-scope-calculator 0.1
unity-scope-chromiumbookmarks 0.1
unity-scope-colourlovers 0.1
unity-scope-devhelp 0.1
unity-scope-firefoxbookmarks 0.1
unity-scope-manpages 0.1
unity-scope-openclipart 0.1
unity-scope-texdoc 0.1
unity-scope-tomboy 0.1
unity-scope-virtualbox 0.1
unity-scope-yelp 0.1
unity-scope-zotero 0.1
urllib3 1.22
wadllib 1.3.2
webencodings 0.5
Werkzeug 0.16.0
wheel 0.30.0
wrapt 1.11.2
xkit 0.0.0
zope.interface 4.3.2
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

But when i run the simple demo ,some errors still existed
root@tx2:~/Documents# python3 skitest.py
Traceback (most recent call last):
File “skitest.py”, line 1, in
import skimage.transform as st
ModuleNotFoundError: No module named ‘skimage’

and the skitest.py is as follows:
import skimage.transform as st
import numpy as np
import matplotlib.pyplot as plt
#matplotlib inline

构建测试图片

image = np.zeros((100, 100)) #背景图
idx = np.arange(25, 75) #25-74序列
image[idx[::-1], idx] = 255 # 线条
image[idx, idx] = 255 # 线条/

hough线变换

h, theta, d = st.hough_line(image)

#生成一个一行两列的窗口(可显示两张图片).
fig, (ax0, ax1) = plt.subplots(1, 2, figsize=(8, 6))
plt.tight_layout()

#显示原始图片
ax0.imshow(image, plt.cm.gray)
ax0.set_title(‘Input image’)
ax0.set_axis_off()

#显示hough变换所得数据
ax1.imshow(np.log(1 + h))
ax1.set_title(‘Hough transform’)
ax1.set_xlabel(‘Angles (degrees)’)
ax1.set_ylabel(‘Distance (pixels)’)
ax1.axis(‘image’)
plt.show()

SO what should i do ,please tell me.

same problem here, there’s no solution jet?

Hi, martin.chavez

This topic was one year old, and the information is out of date.

For JetPack4.4.1, numpy is preinstalled.
You can also install other libraries with the instructions shared in the below post:

Thanks.