Difference between revisions of "OctoPrint"
Jump to navigation
Jump to search
(16 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
* https://octoprint.org/download/ | * https://octoprint.org/download/ | ||
− | === Installing | + | === Installing Python3 including pip and virtual env === |
<source lang='bash'> | <source lang='bash'> | ||
− | + | python3 --version | |
− | Python | + | Python 3.7.3 |
− | |||
− | |||
+ | pip3 install virtualenv | ||
+ | ... | ||
Collecting virtualenv | Collecting virtualenv | ||
− | + | ... | |
− | + | Successfully installed distlib-0.3.1 filelock-3.0.12 virtualenv-20.2.1 | |
− | |||
− | |||
</source> | </source> | ||
virtualenv will not be available via command line at this point so the instructions | virtualenv will not be available via command line at this point so the instructions | ||
from the [https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337 forum article] will provide virtualenv. | from the [https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337 forum article] will provide virtualenv. | ||
<source lang='bash'> | <source lang='bash'> | ||
− | sudo apt install | + | sudo apt install python3-pip python3-dev python-setuptools python-virtualenv git libyaml-dev build-essential |
</source> | </source> | ||
+ | |||
=== Obtaining the octoprint source === | === Obtaining the octoprint source === | ||
<source lang='bash'> | <source lang='bash'> | ||
Line 39: | Line 38: | ||
<source lang='bash'> | <source lang='bash'> | ||
wf@pito:~/source/python/OctoPrint $ ./venv/bin/python setup.py install | wf@pito:~/source/python/OctoPrint $ ./venv/bin/python setup.py install | ||
− | |||
− | |||
− | |||
− | |||
... | ... | ||
− | + | Using /home/wf/OctoPrint/venv/lib/python3.7/site-packages | |
+ | Finished processing dependencies for OctoPrint==1.5.1 | ||
+ | </source> | ||
− | |||
− | |||
− | |||
=== Start OctoPrint Server === | === Start OctoPrint Server === | ||
<source lang='bash'> | <source lang='bash'> | ||
Line 58: | Line 52: | ||
<pre>http://<octoprintserver>:5000/</pre> | <pre>http://<octoprintserver>:5000/</pre> | ||
Will bring up the Setup Wizard | Will bring up the Setup Wizard | ||
− | + | == CuraEngine == | |
* http://docs.octoprint.org/en/master/bundledplugins/cura.html | * http://docs.octoprint.org/en/master/bundledplugins/cura.html | ||
+ | <source lang='bash'> | ||
+ | sudo apt-get -y install gcc-4.7 g++-4.7 | ||
+ | git clone -b legacy https://github.com/Ultimaker/CuraEngine.git | ||
+ | cd CuraEngine | ||
+ | make | ||
+ | </source> | ||
+ | == Webcam == | ||
+ | see .g. | ||
+ | * https://plastikjunkies.de/raspberry-octoprint-webcam/4/ | ||
+ | * https://community.octoprint.org/t/available-mjpg-streamer-configuration-options/1106 | ||
+ | === MJpegStreamer === | ||
+ | * https://github.com/jacksonliam/mjpg-streamer | ||
+ | * https://wiki.ubuntuusers.de/MJPG-Streamer/ | ||
+ | <source lang='bash'> | ||
+ | sudo apt-get install libjpeg-dev libjpeg8-dev imagemagick libav-tools cmake | ||
+ | git clone https://github.com/jacksonliam/mjpg-streamer.git | ||
+ | cd mjpg-streamer/mjpg-streamer-experimental | ||
+ | make | ||
+ | </source> | ||
+ | |||
+ | == Autostart == | ||
+ | === .config/autostart/octoprint.desktop=== | ||
+ | <source lang='bash'> | ||
+ | [Desktop Entry] | ||
+ | Type=Application | ||
+ | Name=OctoPrint | ||
+ | Comment=OctoPrint service | ||
+ | NoDisplay=true | ||
+ | Exec=/home/wf/bin/octoprint | ||
+ | </source> | ||
+ | === Add your user to group dialout === | ||
+ | You might want to run this command once to get access to the /dev/ttyUSB0 device | ||
+ | <source lang='bash'> | ||
+ | sudo usermod -a -G dialout $(whoami) | ||
+ | </source> | ||
+ | === octoprint start script === | ||
+ | <source lang='bash'> | ||
+ | #!/bin/bash | ||
+ | # WF 2019-02-24 | ||
+ | # Octoprint startup script | ||
+ | |||
+ | # set these variables according to your installation | ||
+ | mjpg=$HOME/source/cpp/mjpg-streamer | ||
+ | mjpg_port=8080 | ||
+ | octo=$HOME/source/python/OctoPrint | ||
+ | |||
+ | # | ||
+ | # check whether the given process runs | ||
+ | # param #1: l_process - the process to check | ||
+ | # | ||
+ | check_run() { | ||
+ | local l_process="$1" | ||
+ | pgrep -fl "$l_process" | ||
+ | local l_presult=$? | ||
+ | if [ $l_presult -eq 0 ] | ||
+ | then | ||
+ | echo "$l_process already running" | ||
+ | # comment out as you like | ||
+ | # either stop here | ||
+ | #echo "to kill the process you might want to use" | ||
+ | #echo "pkill -f $l_process" | ||
+ | #exit 1 | ||
+ | # or fully automatic kill | ||
+ | echo "killing $l_process" | ||
+ | pkill -f "$l_process" | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # make sure the given logfile exists and is accessible | ||
+ | # param #1: l_logfile | ||
+ | # | ||
+ | prepare_log() { | ||
+ | local l_logfile=$1 | ||
+ | sudo touch $l_logfile | ||
+ | sudo chown $(whoami) $l_logfile | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # start the webcam streamer | ||
+ | # | ||
+ | start_streamer() { | ||
+ | check_run mjpg_streamer | ||
+ | cd $mjpg/mjpg-streamer-experimental | ||
+ | log=/var/log/mjpeg_streamer.log | ||
+ | prepare_log $log | ||
+ | echo "starting mjpg_streamer logging to $log" | ||
+ | nohup ./mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1920x1080" -o "output_http.so -p $mjpg_port -w ./www" >> $log 2>&1 & | ||
+ | } | ||
+ | |||
+ | |||
+ | # | ||
+ | # start octoprint | ||
+ | # | ||
+ | start_octoprint() { | ||
+ | check_run "octoprint serve" | ||
+ | log=/var/log/octoprint.log | ||
+ | prepare_log $log | ||
+ | cd $octo | ||
+ | echo "starting octoprint logging to $log" | ||
+ | nohup ./venv/bin/octoprint serve >> $log 2>&1 & | ||
+ | } | ||
+ | |||
+ | start_streamer | ||
+ | start_octoprint | ||
+ | </source> | ||
+ | = Installation on MacOS = | ||
+ | * https://community.octoprint.org/t/setting-up-octoprint-on-macos/13425 | ||
= Support = | = Support = |
Latest revision as of 11:00, 6 December 2020
Installation on existing raspbian
Installation from source
see the five steps described in the "Installing from source" section of
Installing Python3 including pip and virtual env
python3 --version
Python 3.7.3
pip3 install virtualenv
...
Collecting virtualenv
...
Successfully installed distlib-0.3.1 filelock-3.0.12 virtualenv-20.2.1
virtualenv will not be available via command line at this point so the instructions from the forum article will provide virtualenv.
sudo apt install python3-pip python3-dev python-setuptools python-virtualenv git libyaml-dev build-essential
Obtaining the octoprint source
git clone https://github.com/foosel/OctoPrint.git
Creating a virtual environment
wf@pito:~/source/python/OctoPrint $ virtualenv venv
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/wf/source/python/OctoPrint/venv/bin/python2
Also creating executable in /home/wf/source/python/OctoPrint/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Installing OctoPrint into that virtual environment
wf@pito:~/source/python/OctoPrint $ ./venv/bin/python setup.py install
...
Using /home/wf/OctoPrint/venv/lib/python3.7/site-packages
Finished processing dependencies for OctoPrint==1.5.1
Start OctoPrint Server
./venv/bin/octoprint serve
Finish Install via Webbrowser
Octoprint listens on port 5000 by default:
http://<octoprintserver>:5000/
Will bring up the Setup Wizard
CuraEngine
sudo apt-get -y install gcc-4.7 g++-4.7
git clone -b legacy https://github.com/Ultimaker/CuraEngine.git
cd CuraEngine
make
Webcam
see .g.
- https://plastikjunkies.de/raspberry-octoprint-webcam/4/
- https://community.octoprint.org/t/available-mjpg-streamer-configuration-options/1106
MJpegStreamer
sudo apt-get install libjpeg-dev libjpeg8-dev imagemagick libav-tools cmake
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make
Autostart
.config/autostart/octoprint.desktop
[Desktop Entry]
Type=Application
Name=OctoPrint
Comment=OctoPrint service
NoDisplay=true
Exec=/home/wf/bin/octoprint
Add your user to group dialout
You might want to run this command once to get access to the /dev/ttyUSB0 device
sudo usermod -a -G dialout $(whoami)
octoprint start script
#!/bin/bash
# WF 2019-02-24
# Octoprint startup script
# set these variables according to your installation
mjpg=$HOME/source/cpp/mjpg-streamer
mjpg_port=8080
octo=$HOME/source/python/OctoPrint
#
# check whether the given process runs
# param #1: l_process - the process to check
#
check_run() {
local l_process="$1"
pgrep -fl "$l_process"
local l_presult=$?
if [ $l_presult -eq 0 ]
then
echo "$l_process already running"
# comment out as you like
# either stop here
#echo "to kill the process you might want to use"
#echo "pkill -f $l_process"
#exit 1
# or fully automatic kill
echo "killing $l_process"
pkill -f "$l_process"
fi
}
#
# make sure the given logfile exists and is accessible
# param #1: l_logfile
#
prepare_log() {
local l_logfile=$1
sudo touch $l_logfile
sudo chown $(whoami) $l_logfile
}
#
# start the webcam streamer
#
start_streamer() {
check_run mjpg_streamer
cd $mjpg/mjpg-streamer-experimental
log=/var/log/mjpeg_streamer.log
prepare_log $log
echo "starting mjpg_streamer logging to $log"
nohup ./mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1920x1080" -o "output_http.so -p $mjpg_port -w ./www" >> $log 2>&1 &
}
#
# start octoprint
#
start_octoprint() {
check_run "octoprint serve"
log=/var/log/octoprint.log
prepare_log $log
cd $octo
echo "starting octoprint logging to $log"
nohup ./venv/bin/octoprint serve >> $log 2>&1 &
}
start_streamer
start_octoprint