scikit-learn for Python 3 on Jetson Xavier

Has anyone successfully installed scikit-learn on Jetson Xavier?

was getting this error:

error: Command β€œaarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.6m -c sklearn/neighbors/quad_tree.c -o build/temp.linux-aarch64-3.6/sklearn/neighbors/quad_tree.o -MMD -MF build/temp.linux-aarch64-3.6/sklearn/neighbors/quad_tree.o.d” failed with exit status 1

----------------------------------------

Command β€œ/usr/bin/python3 -u -c β€œimport setuptools, tokenize;file=’/tmp/pip-build-iec45mu7/scikit-learn/setup.py’;f=getattr(tokenize, β€˜open’, open)(file);code=f.read().replace(’\r\n’, β€˜\n’);f.close();exec(compile(code, file, β€˜exec’))” install --record /tmp/pip-n_3crfi4-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-iec45mu7/scikit-learn/

something in the following made it work:

pip3 install --upgrade setuptools
sudo pip3 install -U setuptools
sudo apt-get install libpcap-dev libpq-dev
sudo pip3 install cython

finally!:

sudo pip3 install git+https://github.com/scikit-learn/scikit-learn.git

3 Likes

Thanks for the sharing.

Can this method be followed for Jetson TX2 board?

Hi,

I think it should work.
I was able to install on Jetson TX1 using the same steps.

Cheers,
Ritvik

Hi,

I tried on a Jetson nano … it failed.
Any idea how to install scikit-learn on a nano ?
Many thanks for your help …

Gilles

Hi,

Please check this topic for the installation scikit-learn on Jetson Nano:
https://devtalk.nvidia.com/default/topic/1049684/jetson-nano/errors-during-install-sklearn-/

Thanks.

Hi,

I use jetson tx2 with jetpack 4.2
I got the following errors trying to install sklearn with the above commands:

ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-86rk0ntw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple – wheel setuptools β€˜Cython>=0.29.13’ β€˜numpy==1.13.3; python_version==’"’"β€˜3.5’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.13.3; python_version==’"’"β€˜3.6’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.14.5; python_version==’"’"β€˜3.7’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.17.3; python_version>=’"’"β€˜3.8’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.16.0; python_version==’"’"β€˜3.5’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ β€˜numpy==1.16.0; python_version==’"’"β€˜3.6’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ β€˜numpy==1.16.0; python_version==’"’"β€˜3.7’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ β€˜numpy==1.17.3; python_version>=’"’"β€˜3.8’"’"’ and platform_system==’"’"β€˜AIX’"’"’’
cwd: None
Complete output (39 lines):
Traceback (most recent call last):
File β€œ/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
β€œmain”, mod_spec)
File β€œ/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File β€œ/usr/local/lib/python3.6/dist-packages/pip/main.py”, line 16, in
from pip._internal.main import main as _main # isort:skip # noqa
File β€œ/usr/local/lib/python3.6/dist-packages/pip/_internal/main.py”, line 8, in
import locale
File β€œ/usr/lib/python3.6/locale.py”, line 16, in
import re
File β€œ/usr/lib/python3.6/re.py”, line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module β€˜enum’ has no attribute β€˜IntFlag’
Error in sys.excepthook:
Traceback (most recent call last):
File β€œ/usr/lib/python3/dist-packages/apport_python_hook.py”, line 53, in apport_excepthook
if not enabled():
File β€œ/usr/lib/python3/dist-packages/apport_python_hook.py”, line 24, in enabled
import re
File β€œ/usr/lib/python3.6/re.py”, line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module β€˜enum’ has no attribute β€˜IntFlag’

Original exception was:
Traceback (most recent call last):
File β€œ/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
β€œmain”, mod_spec)
File β€œ/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File β€œ/usr/local/lib/python3.6/dist-packages/pip/main.py”, line 16, in
from pip._internal.main import main as _main # isort:skip # noqa
File β€œ/usr/local/lib/python3.6/dist-packages/pip/_internal/main.py”, line 8, in
import locale
File β€œ/usr/lib/python3.6/locale.py”, line 16, in
import re
File β€œ/usr/lib/python3.6/re.py”, line 142, in
class RegexFlag(enum.IntFlag):
AttributeError: module β€˜enum’ has no attribute β€˜IntFlag’

ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-86rk0ntw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple – wheel setuptools β€˜Cython>=0.29.13’ β€˜numpy==1.13.3; python_version==’"’"β€˜3.5’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.13.3; python_version==’"’"β€˜3.6’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.14.5; python_version==’"’"β€˜3.7’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.17.3; python_version>=’"’"β€˜3.8’"’"’ and platform_system!=’"’"β€˜AIX’"’"’’ β€˜numpy==1.16.0; python_version==’"’"β€˜3.5’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ β€˜numpy==1.16.0; python_version==’"’"β€˜3.6’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ β€˜numpy==1.16.0; python_version==’"’"β€˜3.7’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ β€˜numpy==1.17.3; python_version>=’"’"β€˜3.8’"’"’ and platform_system==’"’"β€˜AIX’"’"’’ Check the logs for full command output.

The same error on my side - it doesn’t helped when I’ve uninstalled enum34
Any help appreciated