Setting up OctoPrint on Windows

This guide will help you install OctoPrint onto Windows.

: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:

Consider using OctoPrint-WindowsInstaller, an installation wizard for OctoPrint, maintained by jneilliii as an alternative to the below manual instructions.

Installing Python and OctoPrint

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

  1. Install Python 3 from python.org.
    You need a version between 3.7 and 3.11 to run OctoPrint, Choose either the x86 or x64 builds, depending on your platform or preference. DO NOT install Python 3.12, OctoPrint is not yet compatible.
    When installing, be sure to include pip in the installation and also to have the installer add python to your path:

    On the next page, it's useful to check 'Install for all users' to make Python install to C:\Program Files\ and be easier to find later on:

  2. Download & Install Build tools for Visual studio. (On the download page, scroll down, under 'All downloads' open 'Tools for Visual Studio' and download 'Build tools for Visual Studio', you don't need the whole thing) This is required to install some dependencies of OctoPrint & some plugins.

    Select “Desktop development with C++” and ensure the latest versions of “MSVCv143 - VS 2022 C++ x64/x86 build tools” and “Windows 10 SDK” are checked in the configuration on the right.

  3. Open a command prompt (Win+R and execute cmd, or just search for 'Command Prompt').
    Check you are using the correct Python version you installed above, using py --version:

    > py --version
    Python 3.9.2
    

    If this says "Python 3.12" start again at step 1. As stated there, current stable OctoPrint is not yet compatible to Python 3.12, you need Python 3.11 at most!

    If it is not using the correct one because you have multiple Python versions installed, wherever the guide says py below, use the path to the Python version you want to use. For example, C:\Program Files\Python39\python.exe.

  4. Using the File 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 and create a new virtual environment, and then activate it:

    cd C:\OctoPrint
    py -m venv venv
    venv\Scripts\activate.bat
    

    You should notice that the prompt now has (venv) in front of it. This means the virtual environment is 'activated'.

  6. Install OctoPrint and its dependencies using pip:

    pip install octoprint
    

    Hopefully that will be a success, with the final line showing something like this with all the dependencies:

    Successfully installed octoprint ...
    

    :spiral_notepad: Note

    If this installs an old version of OctoPrint, pip probably still has something cached. In that case add --no-cache-dir to the install command, e.g.

    pip install --no-cache-dir octoprint
    

    To make this permanent, clean pip's cache by deleting %LocalAppData%\pip\Cache.

  7. Start OctoPrint simply by executing octoprint serve:

    (venv) C:\OctoPrint>octoprint serve
    2020-11-03 17:39:17,979 - octoprint.startup - INFO - ***************************
    2020-11-03 17:39:17,980 - octoprint.startup - INFO - Starting OctoPrint 1.4.2
    2020-11-03 17:39:17,980 - octoprint.startup - 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: Automatically start on startup

See this post shared by @Arg0n in the comments:

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 and switch the "java" setting to "mjpg" if necessary. 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. Install the new OctoPrint version::

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

    That should 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.4.2
    
  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

:spiral_notepad: Note

If this installs an old version of OctoPrint, pip probably still has something cached. In that case add --no-cache-dir to the install command, e.g.

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

To make this permanent, clean pip's cache by deleting %LocalAppData%\pip\Cache.

Guide Changelog

  • November 2020: Switch to recommend install under Python 3
  • April 2021: Use venv instead of virtualenv, to simplify the process. Use py -m to run modules to avoid issues with path not updating properly.
  • July 2023: Add note linking to OctoPrint-WindowsInstaller.
8 Likes

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.

1 Like

@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.

3 Likes

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.)

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

2 Likes

I would like to run OctoPrint on a windows xp computer. I followed the tutorial as given and it seems to work up until I try to put up the server with the "octoprint serve" command. At this point, I get a RuntimeError stating that my version of windows is too old and I need psutil 3.4.2 to run on Windows XP. Is this a futile effort or do you know some way around this?

Followed this tutorial and now i have octoprint on my windows machine. Now how can I access it outside of my network as I can only access it via local host or internal ip inside my network? I’m currently using octopi anywhere and/or astroprint to see the laptop camera on my phone and control the current print but looking to access the full octoprint capabilities not just access to camera outside of my network

Additionally, I'd suggest adding:

  1. There's a known issue using the Internet Explorer v11 browser to access the OctoPrint interface...
  2. Make sure to turn off your computer's power-saving features to include: sleep, network adapter, disks and desktop lock.

This is my opinion of course, but not only is Windows XP of little use, neither is Windows these days. A Raspberry Pi 3 computer will set you back a whopping $35 plus the cost of a microSD card.

Doing the math, if you leave your XP-based computer on 365 days per year, that will cost you about $225 for the electricity to run it. Compare this to the $5.71 that it would cost to run the Raspberry Pi 3 for a year.

Any questions?

1 Like

I agree generally. However there are plenty of Atom based Windows tablets floating around for arount $50 that have touchscreens and cameras built in so for me it's a better buy than a Pi and it can run everything a Pi can plus every other legacy app as well.

Just a note for others. I found that when pip installing octoprint I got certificate errors, to get around that you can tell pip that it's a trusted domain like this:

pip --trusted-host get.octoprint.org install https://get.octoprint.org/latest

You comment in your article that running octoprint server on windows is an unusual setup. I happen to have a windows 10 machine next to my printer. Is there any reason I don't want to run on windows? I'm perfectly capable of running linux on debian or buying another raspberry pie but if it runs on windows without any limitations I would rather not add another machine to the setup.

  • Automatic updates of Windows interrupting your prints
  • Power consumption
  • The need to also have a monitor and keyboard and mouse attached (= more space, more power consumption)
  • Updates of OctoPrint (and possibly plugins) not being that straight forward due to Windows locking files that are in use
  • more that I can't think of right now

Thanks. In my case most of that is not relevant since:
Automatic Updates are already off
The machine is already running 24x7
I access the machine remotely already
Updates being more difficult is a thing and could get me to change over time but I'm probably good here.
Don't know what these are.

I appreciate the quick reply and can see how these are valid reasons for many people to not use windows. At this point I'll stick with windows unless another more compelling reason comes up.

For 34 years I coded on Windows-based computers; about 75%+ of the money I made was because of them. And now I'm on Macs and Ubuntu. I now rarely use Microsoft Windows. To me, it just feels like:

  1. Microsoft has lost their edge in the programming space
  2. about 99% of the open-space world is written for some other operating system and not well tested on Windows
  3. there was a period recently in which npm was basically dysfunctional on the Windows platform due to MAX_PATH issues
  4. backslashes versus forward slashes
  5. \n versus \r\n line endings
  6. In a panic, they've been trying to abruptly change their platform and their app delivery to catch up with Apple and Windows 10 is painfully broken as a result

I teach software development. Every day a student walks up with some installation problem on a Windows-based laptop. Mongo doesn't install. Loopback won't compile. Mysql won't install.


To me, the ~$35 cost of a Raspberry Pi 3B computer for OctoPrint is a no-brainer with respect to the minimal hassles you'll see.

Interesting perspective. I have linux machines, raspberry machines, chrome machines, and windows at home for various purposes. Some of which are brought up in your list (although I'm not sure why backslashes vs forward slashes is a factor.). So this is not a factor of a fear of working with non windows machines. I work on linux machines every day at work and home. I just happen to have a windows machine next to the printer (for windows reasons) . Also for reference (not that it's a lot of money) but a pi is closer to $100 by the time you finish getting power adaptors, sd card, camera, case (well I guess now that I have a printer I can print my own case).

The question isn't is linux better than windows but does this product fully work on windows. Why buy a low powered device when I have a full power server that has everything I need sitting 2 feet away?

P.S. I agree. I don't like running mongo or Mysql on windows. Same with Postgres and Oracle. All of these products were designed for Linux first and windows as an afterthought and are complex software.

2 Likes

That one turns up in countless scripts in the npmjs space (think "npm install ...") in which someone blindly fetches the macro __dirname and then tries to concatenate /whatever to it. For Windows, that always breaks.

Google: "__dirname + '/'" Windows for about 92,000 hits on that

There are correct ways of doing this with Node but because of that 99% factor, nobody puts the time into it. And then, there's an issue and someone then deals with it.

I have a fondness for most operating systems. And yet every evening I have a line of Windows-based students who bring me new problems to solve. Every single week I chalk up one more thing to remember within this space as in "ah, Mocha just rev'd to 5.2 and now it's doing this (insert random bad thing)".

An open-source program running under Windows as the operating system is a gamble from Day 1 as well as Day 60 (when you run updates). Gina's going to rev the underlying Python perhaps with v1.3.9 and then—even if it worked great for you on v1.3.8 with the earlier Python—will it continue to work as expected with a platform adjustment? You roll your dice, you take your chances, folks. That's mostly what I'm saying, that it's a new rule of thumb which I'll make up here inline:

In the world of open-source solutions your best chance of success is to have the same operating system, same major revisions of infrastructure and same browser choice as 80% of the coders who contribute to it.

For each degree of deviation from that norm you collectively inherit 10% of all new issues with each revision of each module. Windows represents several degrees of deviation from that norm.

There becomes a point where the aggregate number of hours chasing bug fixes over the span of a year greatly outweighs the cost of choosing the correct platform from the beginning.

~ OutsourcedGuru

I will say that a Raspberry Pi 3B computer has something that your workstations and mine do not: 40 GPIO pins. Do not underestimate the awesomeness of being able to add sensors, relays and such to your computer. Can you plug a USB-based whatever into your Windows computer? Yes. But can you just design something new that nobody else has ever done and do the same? Not necessarily. The true power of a 3D printer is to unleash your inventiveness. Once you get into this mode, you'll start to see possibilities for modding this thing.

1 Like

Linux ain't such a walk in the park either yaknow

I'm becoming more and more convinced that nobody ever actually RUNS programs on Linux, all it seems I ever do is watch the screen scroll up while I install one program so that I can run another program so that I can install the program that I wanted to run in the first place

Oh, you need nodejs for that. So I'll just install nodejs

No, you need to have git for that. So I'll just install git

No, you need to download a tarball for that. Ok, so I'll download a tarball

Okay, I downloaded the tarball. What the hell is a tarball, and how do I squeeze my program out of it ?

Well, you have to untar it

How do I do that ?

You just type tar

If I have to UNTAR it, why am I typing TAR ?

And don't forget the -x

What the hell does the -x do ?

Nevermind. I'll just use an abacus

8 Likes

That's so true that it hurts. :laugh:

2 Likes