Setting up OctoPrint on Windows

setup

#1

:thinking: Do you just want to access your existing OctoPrint instance under Windows?

Then there's absolutely no need to follow this guide, this is for installing the OctoPrint server under Windows, which is probably a rather unusual setup. If all you want is to access your existing OctoPrint instance (e.g. running on a Raspberry Pi via the OctoPi image), fire up your browser of choice and direct it to that instance's URL. Don't know what that is? Read this guide instead.

While OctoPrint's intended use case is to be installed on low-powered embedded devices with Linux, it is platform agnostic and can also be installed under Windows instead of the more common option of installing it on something like a Pi.

:warning: Warning

Make sure to disable automatic reboots for updates in your Windows configuration if you intend to run OctoPrint productively under Windows, or your prints will get interrupted by that when you least expect it.

The nature of how windows handles file access also makes it currently impossible to update OctoPrint through itself (including switching to a release candidate and back to stable). You'll need to do that through the command line, and that might become annoying quickly.

To save you some hassle, it might be easier to just get yourself a Raspberry Pi or similar and install OctoPrint through OctoPi on that :wink:

Installing Python, Git and OctoPrint

To install OctoPrint from source under Windows, you'll need to do the following:

  1. Install Python 2.7 for 32bit from here (choose the "Windows x86 MSI Installer" package). Make sure to include pip in the installation and also to have the installer add python to your path.

    Python installation dialog

  2. Install the Microsoft Visual C++ Compiler for Python 2.7 from here.

  3. Open a command prompt (Win+R and execute cmd) and install virtualenv using pip install virtualenv:

    pip install virtualenv
    

    You'll see something like the following, with different version numbers (prompt and output included, do not copy-paste this!):

    C:\Users\YourUser>pip install virtualenv
    You are using pip version 7.0.1, however version 7.1.2 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    Collecting virtualenv
       Using cached virtualenv-13.1.2-py2.py3-none-any.whl
    Installing collected packages: virtualenv
    Successfully installed virtualenv-13.1.2
    

    If you get a message about pip not having been found, your PATH hasn't yet been updated to include. Do it manually for now on the active prompt by redefining PATH:

    PATH=%PATH%;C:\Python27\Scripts
    

    Do not close the window with the prompt, keep it open!

  4. Using the explorer, create a new folder for OctoPrint to reside in. For this tutorial we are assuming this to be C:\OctoPrint.

  5. Open a command prompt (cmd), change into OctoPrint's source folder (cd C:\OctoPrint) and create a new virtualenv: virtualenv venv. Activate it: venv\Scripts\activate.bat.

    cd C:\OctoPrint
    virtualenv venv
    venv\Scripts\activate.bat
    

    That will looks like this (prompt and output included, do not copy-paste this!):

    C:\>cd OctoPrint
    C:\OctoPrint>virtualenv venv
    New python executable in venv\Scripts\python.exe
    Installing setuptools, pip, wheel...done.
    
    C:\OctoPrint>venv\Scripts\activate.bat
    (venv) C:\OctoPrint>
    

    :spiral_notepad: Note:

    At this point it might be a good idea to make sure you have the most current version of pip installed in your venv, so better update that now:

    pip install --upgrade pip
    
  6. Perform a pip install https://get.octoprint.org/latest:

    pip install https://get.octoprint.org/latest
    

    That will look like this, with a different version number (prompt and output included, do not copy-paste this!):

    (venv) C:\OctoPrint>pip install https://get.octoprint.org/latest
    running install
    [...]
    Finished processing dependencies for OctoPrint==1.3.6
    
  7. Start OctoPrint simply by executing octoprint serve:

    (venv) C:\OctoPrint>octoprint serve
    2018-03-20 10:56:22,329 - octoprint.server - INFO - ******************************************************************************
    2018-03-20 10:56:22,332 - octoprint.server - INFO - Starting OctoPrint 1.3.6
    2018-03-20 10:56:22,332 - octoprint.server - INFO - ******************************************************************************
    [...]
    

    :spiral_notepad: Note:

    At this point Windows will probably ask you if you want to allow OctoPrint to be accessible from within your network. Chances are high you want that, so allow access from trusted networks at least.

  8. Open a new tab or window in your browser and enter http://localhost:5000. You should now be looking at your OctoPrint web interface.

    If you want to access it from another computer on your local network, substitute localhost for your PC's IP, e.g. http://192.168.1.3:5000.

Congratulations, you now have a running OctoPrint setup!

To start your OctoPrint server, open a command prompt and run

C:\OctoPrint\venv\Scripts\octoprint.exe serve

If you want to stop OctoPrint, hit Ctrl+C in the command prompt window or simply close it.

Optional: Creating a shortcut

For easier starting of your OctoPrint server in the future you might want to create a shortcut on your desktop or somewhere else you'll easily find again, pointing to C:\OctoPrint\venv\Scripts\octoprint.exe serve:

Creating a shortcut for starting the server

Optional: Installing a webcam server and configuring OctoPrint for it

You can use something like YawCAM for similar functionality to MJPEG-Streamer under Windows. Enable the "HTTP" and "Stream" outputs. If you leave the configured ports at their defaults, your Stream-URL will be http://<ip_of_your_pc>:8081/video.mjpg and your Snapshot-URL will be http://<ip_of_your_pc>:8888/out.jpg.

You can configure these either through OctoPrint's own Settings dialog (see below) or in your config.yaml at %APPDATA%/OctoPrint:

webcam:
  stream: http://<ip_of_your_pc>:8081/video.mjpg
  snapshot: http://localhost:8888/out.jpg

If you also want to be able to use timelapsing, you'll have to obtain a static Windows build of FFMPEG. Those can be found here. Then configure the path to your ffmpeg.exe through the Settings dialog (see below) or config.yaml:

webcam:
  stream: http://<ip_of_your_pc>:8081/video.mjpg
  snapshot: http://localhost:8888/out.jpg
  ffmpeg: C:\your\path\to\ffmpeg.exe

:spiral_notepad: Note:

The screenshot shows 192.168.1.3 as the IP of the PC in the configured Stream-URL. You'll need to adjust that to match your PCs IP!

Updating your OctoPrint installation

Due to the nature of Windows it's sadly not possible to have OctoPrint update itself like on other OSes (e.g. a Raspberry Pi running Linux/OctoPi). When you get an update notification, attempting to apply the update from within OctoPrint will fail. You'll have update manually:

  1. Shutdown your OctoPrint server. If it is running the update process will fail.

  2. Open a command prompt. Navigate to the folder your have OctoPrint installed in (here: C:\OctoPrint) and activate the virtual environment:

    C:\>cd OctoPrint
    C:\OctoPrint>venv\Scripts\activate.bat
    (venv) C:\OctoPrint>
    
  3. Perform a pip install --upgrade https://get.octoprint.org/latest:

    pip install --upgrade https://get.octoprint.org/latest
    

    That will look like this, with a different version number (prompt and output included, do not copy-paste this!):

    (venv) C:\OctoPrint>pip install --upgrade https://get.octoprint.org/latest
    running install
    [...]
    Finished processing dependencies for OctoPrint==1.3.6
    
  4. Restart your OctoPrint server. Your upgrade is done.

Switching to another release channel

The instructions are basically the same as for Updating, the difference is only the URL you use for pip install --upgrade, which depends on the chosen release channel:

  • Stable: https://get.octoprint.org/latest
  • Maintenance RCs: https://get.octoprint.org/maintenance-rc
  • Devel RCs: https://get.octoprint.org/devel-rc

Environment setup and plug in source location
Change port for localhost
Setup OctoPrint on Windows Server
How to use the release channels to help test release candidates
#2

In response to a question on another forum which referred to this post: The post above is not about using a Windows PC to access OctoPrint running on a Raspberry Pi (that's simply a matter of pointing your PC's web browser to the correct location). The above post details installing OctoPrint on a Windows PC, instead of running it on a Pi.


#3

@John_Mc It always astonishes me how people interpret things :wink: I've rephrased the first sentence a bit to hopefully make it crystal clear.


#4

I agree... and it seems no matter how you phrase it, it won't make sense to some people. Sometimes we read what we want to see or what we already think, rather than what is actually on the page. (Guilty of that myself on occasion.)


#5

This its very nice, I want a bot farm under windows with octoprint first I'm running it on an I3 desktop machine if everything goes smooth ill change to a dell server I own, but how can I create multiple instances under windows or debian @foosel