Setting up OctoPrint on Windows

Thank you. I misread that.

To make updating OctoPrint easier on my Windows computer, I created this .BAT file. I just put the .BAT file on my Windows desktop and double-click it when I need to update. It automatically triggers the User Account Control (UAC) prompt to elevate to admin rights, kills the existing server if it's running, updates, and starts the server back up.

If you have OctoPrint set up to run as a service, the stopping and restarting commands in here probably won't work. I know there are command lines to stop and start services though so you could modify the BAT file replace those parts.

@echo off

REM Trigger UAC for admin rights
cd /D "%~dp0"
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)

cls
echo.
echo.
echo Ready to update the OctoPrint server.
echo.
echo.
echo Press CTRL-C to quit or
pause

REM Kill running server
taskkill /IM octoprint.exe /T /F

REM Perform update
echo.
echo.
echo Updating...
cd C:\Octoprint
call venv\Scripts\activate.bat
pip install --upgrade https://get.OctoPrint.org/latest

REM Restart the server
C:\Octoprint\venv\Scripts\octoprint.exe serve

echo.
echo.
echo.
echo OctoPrint Server update is complete.
pause

I couldn't for the life of me fix this issue.. Most things point at having to install for "all users" which I surely did. Tried multiple versions of Python and reinstallations.

Anyway. A workaround was to install the virtualenv package with pip and then use that to create the virtual environment (pip install virtualenv) and then I went to C:\OctoPrint and ran "C:\Program Files\Python310\Scripts\virtualenv.exe" venv

This is completely new to me, but I am trying to get things going on an old laptop, clean win10 install, all updates done, followed this tutorial to the letter, all successful up until there are some yellow lines about missing pyproject.toml or something, I looked up the github link as suggested, but cannot make heads or tails from this, I know I am probably just missing something, but I have to ask how can I get this to work because the successfull install prompt never appeared and octoprint serve does not start the server, just gives another error and many lines of code...

There are no errors in your screenshot. Just some warnings. It also says 'Successfully installed' there, followed by the list of packages it has installed.

Please share the error you have instead.

My apologies, I didn't add the second screenshot, I rebooted the machine, I ran the serve command again, I'll also put the entire output that it shows which is a very long affair...

(venv) C:\Octoprint>octoprint serve
2023-01-06 21:03:50,615 - octoprint.startup - INFO - ******************************************************************************
2023-01-06 21:03:50,615 - octoprint.startup - INFO - Starting OctoPrint 1.8.6
2023-01-06 21:03:50,615 - octoprint.startup - INFO - ******************************************************************************
2023-01-06 21:03:51,161 - octoprint.util.connectivity.connectivity_checker - INFO - Connectivity state is currently: online
2023-01-06 21:03:51,161 - octoprint.util.connectivity.connectivity_checker - INFO - Connecting to 1.1.1.1:53 is working
2023-01-06 21:03:51,161 - octoprint.util.connectivity.connectivity_checker - INFO - Resolving octoprint.org is working
2023-01-06 21:03:51,177 - octoprint.plugin.core - INFO - Loading plugins from C:\Octoprint\venv\Lib\site-packages\octoprint\plugins, C:\Users\dxthi\AppData\Roaming\OctoPrint\plugins and installed plugin packages...
2023-01-06 21:03:52,146 - octoprint.plugin.core - ERROR - Error loading plugin announcements
Traceback (most recent call last):
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 1274, in _import_plugin
module = _load_module(module_name, spec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 52, in _load_module
return imp.load_module(name, f, filename, details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 238, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 212, in load_package
return load(spec)
^^^^^^^^^^^
File "", line 721, in load
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugins\announcements_init
.py", line 22, in
from octoprint.server.util.flask import (
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)
2023-01-06 21:03:52,193 - octoprint.plugin.core - ERROR - Error loading plugin appkeys
Traceback (most recent call last):
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 1274, in _import_plugin
module = _load_module(module_name, spec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 52, in _load_module
return imp.load_module(name, f, filename, details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 238, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 212, in load_package
return load(spec)
^^^^^^^^^^^
File "", line 721, in load
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugins\appkeys_init
.py", line 12, in
from octoprint.server import NO_CONTENT, admin_permission, current_user
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)
2023-01-06 21:03:52,271 - octoprint.plugin.core - ERROR - Error loading plugin backup
Traceback (most recent call last):
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 1274, in _import_plugin
module = _load_module(module_name, spec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 52, in _load_module
return imp.load_module(name, f, filename, details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 238, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 212, in load_package
return load(spec)
^^^^^^^^^^^
File "", line 721, in load
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugins\backup_init
.py", line 8, in
from octoprint.server import NO_CONTENT
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)
2023-01-06 21:03:52,490 - octoprint.plugin.core - ERROR - Error loading plugin logging
Traceback (most recent call last):
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 1274, in _import_plugin
module = _load_module(module_name, spec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 52, in _load_module
return imp.load_module(name, f, filename, details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 238, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 212, in load_package
return load(spec)
^^^^^^^^^^^
File "", line 721, in load
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugins\logging_init
.py", line 14, in
from octoprint.server import NO_CONTENT
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)
2023-01-06 21:03:52,615 - octoprint.plugin.core - ERROR - Error loading plugin pluginmanager
Traceback (most recent call last):
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 1274, in _import_plugin
module = _load_module(module_name, spec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 52, in _load_module
return imp.load_module(name, f, filename, details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 238, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 212, in load_package
return load(spec)
^^^^^^^^^^^
File "", line 721, in load
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugins\pluginmanager_init
.py", line 29, in
from octoprint.server import safe_mode
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)
2023-01-06 21:03:52,755 - octoprint.plugin.core - ERROR - Error loading plugin softwareupdate
Traceback (most recent call last):
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 1274, in _import_plugin
module = _load_module(module_name, spec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugin\core.py", line 52, in _load_module
return imp.load_module(name, f, filename, details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 238, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\vendor\imp.py", line 212, in load_package
return load(spec)
^^^^^^^^^^^
File "", line 721, in load
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Octoprint\venv\Lib\site-packages\octoprint\plugins\softwareupdate_init
.py", line 24, in
from octoprint.server import BRANCH, NO_CONTENT, REVISION, VERSION
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)
2023-01-06 21:03:52,911 - octoprint.plugin.core - INFO - Plugin Pi Support Plugin (2022.6.13) did not pass check, not loading.
2023-01-06 21:03:53,036 - octoprint.plugin.core - INFO - Found 11 plugin(s) providing 11 mixin implementations, 15 hook handlers
2023-01-06 21:03:53,099 - octoprint.cli.server - ERROR - Uncaught exception
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Octoprint\venv\Scripts\octoprint.exe_main
.py", line 7, in
sys.exit(main())
^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint_init
.py", line 936, in main
octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT")
File "C:\Octoprint\venv\Lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\click\core.py", line 1657, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\click\core.py", line 760, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\cli\server.py", line 317, in serve_command
run_server(
File "C:\Octoprint\venv\Lib\site-packages\octoprint\cli\server.py", line 145, in run_server
from octoprint.server import CannotStartServerException, Server
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server_init
.py", line 46, in
from octoprint.server import util
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util_init
.py", line 21, in
from . import flask, sockjs, tornado, watchdog # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Octoprint\venv\Lib\site-packages\octoprint\server\util\flask.py", line 34, in
import octoprint.access.users
File "C:\Octoprint\venv\Lib\site-packages\octoprint\access\users.py", line 11, in
import wrapt
File "C:\Octoprint\venv\Lib\site-packages\wrapt_init
.py", line 10, in
from .decorators import (adapter_factory, AdapterFactory, decorator,
File "C:\Octoprint\venv\Lib\site-packages\wrapt\decorators.py", line 34, in
from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py)

(venv) C:\Octoprint>

Had the same problem today.
Check your version of Python, it should be between 3.7 and 3.9 (I have 3.9 and it works).
If that doesn't fix it have a look at your Visual Studio settings.
Hopefully, this helps.

HI I am getting an error when trying to run with octoprint serve it says ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Program Files\Python311\Lib\inspect.py) what does this mean and how can I fix it.

OctoPrint is not yet compatible with Python 3.11, as pointed out at the beginning of this guide:

It will be soon, however: Compatibility with Python 3.11 Β· Issue #4488 Β· OctoPrint/OctoPrint Β· GitHub

1 Like

do you think it could be the fact that im on windows 11 or that im on py 3.10.9

The error message shows you are using Python 3.11.

i am having trouble connecting my cr-10 smart to octoprint. Do you need a pi if you installed it on windows

For anyone with issues connecting to a Prusa MK3 over USB cable, try the following settings

In printer: RPI Port: OFF
In Octoprint:
COM port: Manually select
BAUD rate: AUTO

how are you connecting your PC to the printer? CR-10 Smart requires modding the hardware to connect to USB.

This is the second time I am following this walk thru and for some reason it is not working, getting a lot of errors. Attached is a Zip with a txt file with the output after running octoprint serve. Thoughts?

UPDATE: I installed Python 3.11, removed and installed 3.10.9 and now it is working.

OctoError.zip (1.8 KB)

can someone please help me fix why my Logitech C922 doesn't show the stream? it works on the camera app, but not in Octoprint server. I saw that people changed their port or updated the URL and it worked. I tried it but it still doesn't show the stream and I get the broken image icon. My current setting is:

http://127.0.0.1:25000/webcam/?action=stream

The first question is have you installed anything to stream the webcam. In this guide it suggests installing Yawcam to provide the stream. It also says, if you have installed that, to configure the stream URL as such:

The current setting you have I would say is almost guaranteed to not work, unless you have setup a reverse proxy on port 25000 and are using something that has the same parameters as mjpg streamer.

1 Like

it worked! thank you!

Did you ever find a solution for this? I'm getting the same error.