[PYTHON] I can't use the darknet command in Google Colaboratory!

Background I wanted to learn the weight of yolo with Google Colaboratory with ./darknet detector train ~ (validated locally), but ./darknet: permission denied and permission error are displayed

Environment ・ Mac OS Catalina 10.15.6 ・ Google Colaboratory ・ Python 3.6.9 ・ Tensorflow 1.4.2


Permission error First, solve the following
./darknet: permission denied

Solved by changing darknet permissions

chmod 755 darknet

But again the error

Binary file execution error Then solve the following
./darknet: cannot execute binary file: exec format error

This is because the compiled file does not correspond and it can not be executed The gcc version doesn't seem to correspond to the nvcc version    In fact, if you check the output when you make the Makefile

gnu version! gcc versions later than 5 are not supported!

And gcc version error was mentioned    Let's check with the compiler change command

!update-alternatives --config gcc

After all it seems to be for gcc 7

Solution Run the following command to install gcc 4.8 and set it as the default
!sudo update-alternatives --remove-all gcc 
!sudo update-alternatives --remove-all g++

!sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
!sudo apt-get update

!sudo apt-get install gcc-4.8 g++-4.8

!sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
!sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

!sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 50
!sudo update-alternatives --set cc /usr/bin/gcc

!sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 50
!sudo update-alternatives --set c++ /usr/bin/g++

!sudo update-alternatives --config gcc
!sudo update-alternatives --config g++

As a result of checking with the compiler change command, I was able to properly set gcc 4.8 as the default.

$!update-alternatives --config gcc
There is only one alternative in link group gcc (providing /usr/bin/gcc): /usr/bin/gcc-4.8
Nothing to configure.

that's all

Recommended Posts

I can't use the darknet command in Google Colaboratory!
Use The Metabolic Disassembler on Google Colaboratory
Use cartopy without bugs in Google Colaboratory
I can't get the element in Selenium!
Use the command previously entered in IDLE
I can't use the "next_results" parameter in the Twitter API Search API! ?? Causes and remedies
[Note] I can't call the installed module in jupyter
How to use Spacy Japanese model in Google Colaboratory
I want to use the R dataset in python
[Implementation explanation] How to use the Japanese version of BERT in Google Colaboratory (PyTorch)
Use music21 on Google Colaboratory
How to use Google Colaboratory
I checked the Python package pre-installed in Google Cloud Dataflow
I can't log in to the admin page with Django3
I got lost in the maze
I summarized the sar command that Netflix performance engineers also use
I participated in the ISUCON10 qualifying!
I can't enter standard in Subprocess ...
In the python command python points to python3.8
■ [Google Colaboratory] Use morphological analysis (janome)
I tried running GAN in Colaboratory
■ [Google Colaboratory] Use morphological analysis (MeCab)
Snippets (scraping) registered in Google Colaboratory
I can't install scikit-learn in Python
I can't use Japanese with pyperclip
I wrote the queue in Python
What to do if you can't use the trash in Lubuntu 18.04.
I made a command to display a colorful calendar in the terminal
I wrote the stack in Python
I can't import modules in the parent directory even with sys.path.append ('..')
I made a note of Google colaboratory which can use Spleeter easily.
I want to use the Django Debug Toolbar in my Ajax application
I want to leave an arbitrary command in the command history of Shell
[Linux] Why do I, an infrastructure engineer, not use the "hostname" command?
I can't find the commands in the package introduced by pip from Emacs
Use the type features evolved in Sphinx-2.4
I tried to summarize the umask command
Learn the design pattern "Command" in Python
How to use Google Test in C
[Linux] How to use the echo command
How to use the Linux grep command
Resolve the Address already in use error
I can't debug python scripts in Eclipse
I saved the scraped data in CSV!
I wrote the selection sort in C
Use TPU and Keras with Google Colaboratory
Python's "I can't reach the itch ..." feature
I can't deploy with google app engine
I wrote the sliding wing in creation.
I can't install the package with pip.
3 best ways to use the less command
Why can't I install matplotlib in python! !!
Google colaboratory
I made an appdo command to execute a command in the context of the app
I get a strange window when I use the open directory dialog in Tkinter
linux / c> link> Get the execution result of the shell command in the C program> I was taught how to use popen ()
How to use the C library in Python
Use the LIKE clause in golang x SQLite3
Use the latest pip in a virtualenv environment
I tried simulating the "birthday paradox" in Python
I tried the least squares method in Python