简体   繁体   English

Jetson Nano 上的非法指令(核心转储)错误

[英]Illegal instruction(core dumped) error on Jetson Nano

Sorry if my description is long and boring but I want to give you most important details to solve my problem.抱歉,如果我的描述冗长乏味,但我想为您提供最重要的细节来解决我的问题。 Recently I bought a Jetson Nano Developer Kit with 4Gb of RAM, finally,, and in order to get, which I consider: the best configuration for object detection I am following this guide made by Adrian Rosebrock from Pyimagesearch:最近我买了一个带有 4Gb RAM 的 Jetson Nano 开发工具包,最后,为了得到,我认为:object 检测的最佳配置我正在遵循 Pyimagesearch 的 Adrian Rosebrock 制作的指南:

https://www.pyimagesearch.com/2020/03/25/how-to-configure-your-nvidia-jetson-nano-for-computer-vision-and-deep-learning/ Date:March, 2020. A summary of this guide is the following: https://www.pyimagesearch.com/2020/03/25/how-to-configure-your-nvidia-jetson-nano-for-computer-vision-and-deep-learning/日期:2020 年 3 月。总结本指南的内容如下:

  • 1: Flash Jetson Pack 4.2.img inside a microSD for Jetson Nano(mine is 32GB 'A' Class) 1: Flash Jetson Pack 4.2.img inside a microSD for Jetson Nano(我的是 32GB 'A' Class)
  • 2: Once inserted on the Nano board, configure Ubuntu 18.04 and get rid of Libreoffice entirely to get more available space 2: 一旦插入到 Nano 板上,配置 Ubuntu 18.04 并完全摆脱 Libreoffice 以获得更多可用空间
  • 3: Step #5: Install system-level dependencies( Including cmake, python3, and nano editor) 3:步骤#5:安装系统级依赖(包括cmake、python3、nano editor)
  • 4: Update CMake (without any errors) 4:更新CMake(无任何错误)
  • 5: Install OpenCV system-level dependencies and other development dependencies 5:安装OpenCV系统级依赖和其他开发依赖
  • 6: Set up Python virtual environments on your Jetson Nano( succesfully installed virtualenv and virtualenvwrapper without errors including the bash file edition with nano) 6: 在你的 Jetson Nano 上设置 Python 虚拟环境(成功安装 virtualenv 和 virtualenvwrapper 没有错误,包括带有 nano 的 bash 文件版本)
  • 7: Create virtaul env with python 3 and install protobuf and libprotobuf to get an more efficient Tensorflow. Succesfully installed. 7: Create virtaul env with python 3 并安装protobuf和libprotobuf以获得更高效的Tensorflow。安装成功。 It took an hour to finish, that's normal花了一个小时才完成,这很正常
  • 8: Here comes the headbreaker: install numpy and cython inside this env and check it importing numpy library When I try to do this step I get: Illegal instruction(core dumped) as you can see in the image: [Error with Python3.6.9]: https://i.stack.imgur.com/rAZhm.png 8:问题来了:在此环境中安装 numpy 和 cython 并检查它导入 numpy 库 当我尝试执行此步骤时,我得到:非法指令(核心转储),如您在图像中所见:[Python3.6.9 错误]: https://i.stack.imgur.com/rAZhm.png

I said, well let's continue with this tutorial anyway:我说,好吧,无论如何让我们继续本教程:

  • 9: Install Scipy v1.3.3: everything is ok with first three lines, but when I have to use python to execute the stup.py file, IT shows up again(not the clown). 9:安装 Scipy v1.3.3:前三行一切正常,但是当我必须使用 python 来执行 stup.py 文件时,IT 再次出现(不是小丑)。 [Can't execute this line either]: https://i.stack.imgur.com/wFmnt.jpg 【这一行也执行不了】: https://i.stack.imgur.com/wFmnt.jpg

Then I ran an experiment, I have created this "p2cv4" env with Python 2, installed numpy and tested it: [With Python 2]: https://i.stack.imgur.com/zCWif.png然后我做了一个实验,我用 Python 2 创建了这个“p2cv4”env,安装了 numpy 并测试了它:[With Python 2]: https://i.stack.imgur.com/zCWif.png

I can exit() whenever I want and execute other lines that use python So I concluded that is a python version issue.我可以随时退出()并执行其他使用 python 的行所以我得出结论,这是一个 python 版本问题。 When I want to execute any python code, terminal ends the program with core dumping, apt-get or pip DO NOT show any errors.当我想执行任何 python 代码时,终端以核心转储结束程序,apt-get 或 pip 不显示任何错误。 And I want to use python 3 because someday in the future a package or library will require python 3.我想使用 python 3,因为将来某一天 package 或图书馆将需要 python 3。

For python 3 last version for the Jetson Nano is 3.6.9, and idk which version was currently active in March, 2020, like the one Adrian used at that time对于 python 3,Jetson Nano 的最后一个版本是 3.6.9,idk 目前在 2020 年 3 月激活的版本,就像 Adrian 当时使用的那个

In other posts I read that this SIGILL appears when a package or library version like Numpy of TF is not friendly anymore with a specific old or low power CPU, like in this posts: Illegal hardware instruction when trying to import tensorflow , https://github.com/numpy/numpy/issues/9532在其他帖子中,我读到当 TF 的 package 或库版本(如 Numpy)不再对特定的旧或低功率 CPU 友好时会出现此 SIGILL,例如在这篇帖子中: Illegal hardware instruction when trying to import tensorflow , https:// github.com/numpy/numpy/issues/9532

So I want to downgrade to a older python version like 3.6.5 or 3.5 but I can't find clear steps to do so in Ubuntu. I thinks this will fix this error and let me continue with configurations on the Jetson Nano.所以我想降级到较旧的 python 版本,如 3.6.5 或 3.5,但我在 Ubuntu 中找不到明确的步骤。我认为这将修复此错误,让我继续在 Jetson Nano 上进行配置。

The pyimageseach guide uses Python 3.6 but it do not specifies if is last 3.6.9 or another. pyimageseach 指南使用 Python 3.6 但它没有指定是最后一个 3.6.9 还是另一个。 If is not python causing this error let me know.如果不是 python 导致此错误,请告诉我。 HELP please!请帮忙!

The 'illegal instruction' could be due to an recent change in the getauxval(AT_HWCAP), an attempt to read cpuid information from /sys/devices in the event that getauxval did not succeed. “非法指令”可能是由于 getauxval(AT_HWCAP) 中的最近更改,在 getauxval 未成功的情况下尝试从 /sys/devices 读取 cpuid 信息。 (OpenBLAS PRs 2952 and 3004) (OpenBLAS PR 2952 和 3004)

export OPENBLAS_CORETYPE=ARMV8 (or whatever the actual hardware is) before launching python should hopefully get around this.在启动 python 之前 export OPENBLAS_CORETYPE=ARMV8 (或任何实际硬件)应该有望解决这个问题。 For example:例如:

OPENBLAS_CORETYPE=ARMV8 python

If you would like to make this export permanent, you should open your.bashrc file by typing on the terminal:如果您想将此导出永久化,您应该通过在终端上键入来打开您的 .bashrc 文件:

nano ~/.bashrc

Afterwards, just add "export OPENBLAS_CORETYPE=ARMV8" to the bottom of your.bashrc file, save/exit and reboot your system:之后,只需将“export OPENBLAS_CORETYPE=ARMV8”添加到.bashrc 文件的底部,保存/退出并重新启动系统:

export OPENBLAS_CORETYPE=ARMV8

for more details look at:有关更多详细信息,请查看:

https://github.com/numpy/numpy/issues/18131 https://www.reddit.com/r/JetsonNano/comments/ktcyoh/illegal_instructioncore_dumped_error_on_jetson/ https://github.com/numpy/numpy/issues/18131 https://www.reddit.com/r/JetsonNano/comments/ktcyoh/illegal_instructioncore_dumped_error_on_jetson/

I had this very same problem following the same guide.按照相同的指南,我遇到了同样的问题。 BTW, in this scenario, numpy worked just fine in python when NOT in a virtualenv.顺便说一句,在这种情况下,当不在 virtualenv 中时,numpy 在 python 中工作得很好。 GDB pointed to a problem in libopenblas. GDB 指出了 libopenblas 中的一个问题。

My solution was to start from scratch with a fresh image of jetson-nano-4gb-jp441-sd-card-image.zip and repeat that guide without using virtualenv.我的解决方案是从头开始使用 jetson-nano-4gb-jp441-sd-card-image.zip 的新图像,然后在不使用 virtualenv 的情况下重复该指南。 More than likely you are the sole developer on that Nano and can live without virtualenv.您很可能是该 Nano 的唯一开发人员,并且可以在没有 virtualenv 的情况下生活。

I have followed these guides with success: https://qengineering.eu/install-opencv-4.5-on-jetson-nano.html我已成功遵循这些指南: https://qengineering.eu/install-opencv-4.5-on-jetson-nano.html

Skip the virtualenv portions https://www.pyimagesearch.com/2019/05/06/getting-started-with-the-nvidia-jetson-nano/跳过 virtualenv 部分https://www.pyimagesearch.com/2019/05/06/getting-started-with-the-nvidia-jetson-nano/

I found this to also be required at this point: "..install the official Jetson Nano TensorFlow by.."我发现此时也需要这样做:“..install the official Jetson Nano TensorFlow by..”

ln -s /usr/include/locale.h /usr/include/xlocale.h

Once I made that symbolic link I was able to proceed with the rest of the guide (minus virtualenv) and I managed to not break numpy.一旦我建立了这个符号链接,我就能够继续使用指南的 rest(减去 virtualenv),并且我设法不破坏 numpy。

This is not ideal, but I hope it helps.这并不理想,但我希望它有所帮助。

I thinks this a bug with Jetson Nano B01 model.我认为这是 Jetson Nano B01 model 的错误。

Yesterday I realized that my Nano is a different model than the one Adrian is showing in his guide(A02).昨天我意识到我的 Nano 与 Adrian 在他的指南 (A02) 中显示的 model 不同。

Thank you doommonkey to lead me to a different guide that looks pretty much to the pyimagesearch tutorial and more recent one (Dec, 2020), I really appreciate that.谢谢你 doommonkey 引导我找到一个不同的指南,它看起来很像 pyimagesearch 教程和最近的一个(2020 年 12 月),我真的很感激。

I will test it today and if I can build my opencv to functional including Tensorflow.我今天将对其进行测试,如果我可以将我的 opencv 构建成功能,包括 Tensorflow。 I think this is a half solved problem.我认为这是一个解决了一半的问题。

It's a shame that virtualenv is giving this awful error for python 3.6.9.很遗憾,virtualenv 给 python 3.6.9 带来了这个可怕的错误。 In th is particular model.特别是 model。 I tried with venv module too and it can't even install numpy so no virtual env for now我也尝试使用 venv 模块,它甚至无法安装 numpy 所以现在没有虚拟环境

Try this, It worked for me.试试这个,它对我有用。 I tested it with pyenv environment with python 3.7.9 and gcc-8.4 on Jetson nano (the very first version).我使用 pyenv 环境在 Jetson nano(第一个版本)上使用 python 3.7.9 和 gcc-8.4 对其进行了测试。 Just remember because it compiles everything, it's gonna take a lot longer than just downloading the binaries.请记住,因为它会编译所有内容,所以它比仅下载二进制文件需要更长的时间。 (because of --no-binary ) (因为--no-binary

python3 -m pip install -U numpy --no-cache-dir --no-binary numpy

You can update your gcc, because default gcc is 7. I am not sure if it does not work with gcc-7.您可以更新您的 gcc,因为默认的 gcc 是 7。我不确定它是否不适用于 gcc-7。

sudo apt install gcc-8 g++-8
sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-8 /usr/bin/gcc

sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-8 /usr/bin/g++

Now to confirm, you can check the version with现在确认,您可以检查版本

gcc --version
g++ --version

No you can do with the virtualenv :不,您可以使用virtualenv

  1. remove all numpy ref in the site packages of the VE ( Vritual Environement),删除 VE(虚拟环境)站点包中的所有 numpy 参考,
  2. upgrade numpy升级 numpy
  3. link numpy folder to VE numpy.将 numpy 文件夹链接到 VE numpy。

Assuming your virtualenv is called ML:假设您的 virtualenv 被称为 ML:

1) 1)

cd ~/.virtualenvs/ML/lib/python3.6/site-packages 
sudo rm -r numpy*
#outside VE:
deactivate
sudo pip install --upgrade numpy
#find path to numpy usig pysearchmethod :
#use pip uninstall numpy, and answer NO, but note. path
sudo pip uninstall numpy
#gives me /home/pierre/.local/lib/python3.6/site-packages/numpy
cd ~/.virtualenvs/ML/lib/python3.6/site-packages
ln -s /home/pierre/.local/lib/python3.6/site-packages/numpy numpy

Then you can test it:然后你可以测试它:

workon ML
python -c 'import numpy'

If you get stuff related to permission on /.cache/pip, you can try to change permission of the folder:如果您获得与/.cache/pip 权限相关的内容,您可以尝试更改文件夹的权限:

sudo chown -R $USER ~/.cache/pip

If this still doesn't work, try uninstallating numpy on the machine, then re installing it:如果这仍然不起作用,请尝试在机器上卸载 numpy,然后重新安装:

sudo pip uninstall numpy
#Yousof
pip install -U numpy --no-cache-dir --no-binary numpy

then go back to steps 1->3.然后 go 返回步骤 1->3。 This has worked for me.这对我有用。

++ ++

Installing the correct numpy version helped me resolve this issue.安装正确的 numpy 版本帮助我解决了这个问题。 Whenever i imported torch, cv2 or torchvision, I got the error saying Illegal instruction(core dumped).每当我导入torch、cv2 或torchvision 时,我都会收到错误指令非法指令(核心转储)。 Use the command pip install numpy==1.19.4 and I hope the error goes.使用命令pip install numpy==1.19.4我希望错误消失。

Installing the correct numpy version helped me resolve this issue.安装正确的 numpy 版本帮助我解决了这个问题。 Whenever i imported torch, cv2 or torchvision, I got the error saying Illegal instruction(core dumped).每当我导入torch、cv2 或torchvision 时,我都会收到错误指令非法指令(核心转储)。 Use the command pip install numpy==1.19.4 and I hope the error goes.使用命令 pip install numpy==1.19.4 我希望错误消失。

Didn't work for me, but i tried this: Miniconda3-py39_4.9.2-Linux-aarch64.sh.对我不起作用,但我试过这个:Miniconda3-py39_4.9.2-Linux-aarch64.sh。 The link to download: https://repo.anaconda.com/miniconda/ ANSWER FROM Conda Init Illegal instruction (core dumped)下载链接: https://repo.anaconda.com/miniconda/ ANSWER FROM Conda Init Illegal instruction (core dumped)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM