-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Trouble installing MXNet on Raspberry Pi 3 #7852
Comments
It looks like the linker isn't finding cblas you may need to manually add the path to the makefile. Also it looks like someone may have pushed a breaking change for our ARM/Rpi build to our makefile @szha ... |
How do I manually add path to cblas in the makefile? |
@arank who's fixing it? |
I have been poking around, looking at the makefile and trying to figure where cblas is installed. This appears to be a lot more complex than I imagined. In the meantime, I just realized that I am using the brand new Stretch version of Raspbian. Don't know if the make had ever been tested with Stretch. Could that be the reason why I have trouble with the installation? |
I would follow the setup guide on mxnet.io exactly, using the Raspbian Jessie version. @szha I am currently traveling w/ no access to a Pi but I can take a look once I am back. |
You can use our docker files to build for arm, we build against or own blas. It should work: |
##Okay, I got jessie running on a Raspberry Pi 3 ##I got the following error: The following packages have unmet dependencies: How can I resolve the dependencies? I know this is not a MXNet issue as such. I am new at this. Any help is much appreciated. BTW, thanks @larroy. I am hoping the issue is with Stretch. Will have to look at your docker approach as backup plan. |
Stack overflow is usually a good place to start w/ these more general questions about more general deb package management... try looking at this answer https://askubuntu.com/questions/563178/the-following-packages-have-unmet-dependencies |
Found out from Sébastien Villemot [email protected] that I have correctly installed LAPACK (shared library, doc and development libraries) and also ATLAS (shared library). Issue is that I gave a wildcard (liblapack*) to apt-get, so it also tried to install virtual packages (like liblapack3gf), which no longer exists but only appears in a Breaks relationship. So, I continued with the MXNet installation by doing: sudo apt-get update
sudo apt-get -y install git cmake build-essential g++-4.8 c++-4.8 liblapack* libblas* libopencv*
git clone https://github.com/dmlc/mxnet.git --recursive
cd mxnet
make However, I got the same error as when I was using Stretch version of Raspbian: /usr/bin/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
Makefile:327: recipe for target 'lib/libmxnet.so' failed
make: *** [lib/libmxnet.so] Error 1 I was going to try loading the cblas library again but this time I got message that libcblas* or libcblas could not be found: pi@raspberrypi:~/mxnet $ sudo apt-get install libcblas*
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libcblas*
E: Couldn't find any package by regex 'libcblas*'
pi@raspberrypi:~/mxnet $ sudo apt-get install libcblas
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libcblas So it appears make would not work for Raspbian jessie as well. @arank, guess I will have to wait for you to take a look at the issue when you can. Thanks. |
Oops, don't know why some of the text were crossed out. Please ignore. Did not mean to cross anything out. |
Thanks for testing this out. I will take a look next week but in the mean time the docker based solution from @larroy should help you get around this since all the dependencies are self contained and it is built against ARMv7. |
@FrancisTse8 markdown supports verbatim code blocks. I edited your comment above. Click edit again to see how it's written |
Cool! @szha, thanks for the tip. |
Hello @larroy, I want to try out the docker files. However, I have a few questions:
Again, thanks for your help. Please also add other pointers that I might have missed from my questions. |
|
OK, I am on the Raspberry Pi 3 running jessie to try to install MXNet. Followed the instructions on https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/ to install docker: curl -sSL https://get.docker.com | sh Downloaded the appropriate dockerfile and modified it to enable openCV. See below (file renamed with .txt to attach here): Verified that docker was installed and I have the the dockerfile I needed: pi@raspberrypi:~ $ which docker
/usr/bin/docker
pi@raspberrypi:~ $ ls dockerfiles
Dockerfile.build.armv7.withOpenCV However, when I ran the docker build, I got a permission denied error: pi@raspberrypi:~ $ docker build -f dockerfiles/Dockerfile.build.armv7.withOpenCV -t mxnet .
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.29/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=dockerfiles%2FDockerfile.build.armv7.withOpenCV&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=mxnet&target=&ulimits=null: dial unix /var/run/docker.sock: connect: permission denied Did I do something wrong or missed some kind of step? |
Don't build it on the PI, build it on your desktop and just copy the mxnet library (the .so) file, then install the python package as normal |
When I was running the make file, I was able to generate a libmxnet.so file. Is this the .so file you are referring to? Since I seem to have the libmxnet.so file on the Raspberry Pi with stretch Raspbian Pi, I tried to continue following the instructions to install python bindings. However, I got the following OSerror: pi@raspberrypi:~/mxnet $ cd python
pi@raspberrypi:~/mxnet/python $ pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 193kB/s
Installing collected packages: pip
Successfully installed pip-9.0.1
pi@raspberrypi:~/mxnet/python $ pip install -e .
Obtaining file:///home/pi/mxnet/python
Collecting graphviz (from mxnet==0.11.1)
Downloading graphviz-0.8-py2.py3-none-any.whl
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (from mxnet==0.11.1)
Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (from mxnet==0.11.1)
Installing collected packages: graphviz, mxnet
Exception:
Traceback (most recent call last):
File "/home/pi/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/pi/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/pi/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/pi/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/pi/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/pi/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/pi/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/pi/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/graphviz' Maybe I need something else from the make process besides generating the libmxnet.so file? |
you should install as root or using a virtualenv |
Thanks @larroy. Seems so obvious once you pointed that out. I was just following the instructions blindly. I redo the commands with sudo and success finally!!! pi@raspberrypi:~/mxnet $ cd python
pi@raspberrypi:~/mxnet/python $ sudo pip install --upgrade pip
Requirement already up-to-date: pip in /usr/lib/python2.7/dist-packages
pi@raspberrypi:~/mxnet/python $ sudo pip install -e .
Obtaining file:///home/pi/mxnet/python
Collecting graphviz (from mxnet==0.11.1)
Downloading graphviz-0.8-py2.py3-none-any.whl
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (from mxnet==0.11.1)
Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (from mxnet==0.11.1)
Installing collected packages: graphviz, mxnet
Running setup.py develop for mxnet
Successfully installed graphviz-0.8 mxnet
pi@raspberrypi:~/mxnet/python $ cd ../..
pi@raspberrypi:~ $ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170124] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mxnet as mx
>>>
>>> mx.__version__
'0.11.1' Seems like mxnet was installed properly. I will have to continue with the example to see if I can actually identify an object. Once that is verified, I will summarize and post what I had to do to make it work. The question I still have is what does the rest of the makefile after line #439 do. I had an error at that line but it was after the .so file was generated. Maybe for testing and validation? Hope someone can shed some light on that error in case something bad is lurking in my installation. |
I was able to follow the instructions on https://aws.amazon.com/blogs/ai/build-a-real-time-object-classification-system-with-apache-mxnet-on-raspberry-pi/ to run the ImageNet-trained SqueezeNet V1.1 model on a save image. So I am quite sure that MXNet is functioning. To save some time for others who might want to install MXNet on a Raspberry Pi, I will summarize what I had to do to make things work:
I will not close this issue yet since there are still questions about what the makefile is supposed to be doing at and after line #439. I will leave it up to someone who knows the makefile to answer the question and close this issue. Hope this makes sense. Thanks everyone for your valuable comments and support. |
FrancisTse8 your latest instruction on installing mxnet on my Pi3 works. The last error number for "bin/im2rec" is different from yours 344 but somehow the libmxnet.so has been compiled in mxnet/lib folder. The Pi3 can run inception model now. Thanks a lot! |
Can this issue be resolved? |
@yzhliu could you help close out this issue as it's been resolved? thanks |
Environment info and background:
Raspberry Pi 3 running Raspbian version 9 stretch
On the newly installed Raspbian on a Raspberry Pi 3, followed instructions on https://aws.amazon.com/blogs/ai/build-a-real-time-object-classification-system-with-apache-mxnet-on-raspberry-pi/ to first install the prerequisites:
sudo apt-get update
sudo apt-get install python-pip python-opencv python-scipy python-picamera
After that, I followed the instructions to go to page https://mxnet.incubator.apache.org/get_started/install.html to install MXNet by selecting Devices and Raspberry Pi.
I followed the instructions and did the following:
sudo apt-get update
sudo apt-get -y install git cmake build-essential g++-4.8 c++-4.8 liblapack* libblas* libopencv*
git clone https://github.com/dmlc/mxnet.git --recursive
cd mxnet
make
Build stopped and got an error message.
Error Message:
...
/usr/bin/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
Makefile:322: recipe for target 'lib/libmxnet.so' failed
make: *** [lib/libmxnet.so] Error 1
What have you tried to solve it?
Thought the problem was just missing a library, so did the following:
pi@raspberrypi:~ $ sudo apt-get install libcblas*
Ran make again and got further (now have libmxnet.so generated). However, got another error.
New Error Message:
/usr/bin/ld: build/src/operator/tensor/la_op.o: undefined reference to symbol 'cblas_dtrsm'
//usr/lib/libblas.so.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:344: recipe for target 'bin/im2rec' failed
make: *** [bin/im2rec] Error 1
Steps to reproduce
Will get the same error each time I run make again.
Need Help
Now, I do not know what to do. Has anyone else come across the same problem. Any suggestions for a solution?
The text was updated successfully, but these errors were encountered: