Windows development environment : no venv, please help

What is the problem?

I installed OctoPrint on my PC : works like a charm. (normally it runs on a Pi for the printer, and on another Pi for testing purpose ; never had a single problem.

I want to learn plugins coding, and followed this guide : https://docs.octoprint.org/en/master/development/environment.html#windows , epic fail !

Before I started with installation :

1 - I unisntalled Git for Windows, Python 2.7, Python 3.8 ; then I reinstalled fresh versions in C:\Git, C:Python27, C:\Python39 ; everything's OK, paths, etc.
2 - installed MSC++ compiler for Python 2.7 (VCForPython27.msi)
3 - Build Tools For Visual Studio 2019 : VS Community 2019 is the first software I install after installing Windows, with C++, MFC, Arduino Visual Micro... Win10 SDK is also installed. (most used software)
3 - installed virtualenv
4 - cloned OctoPrint in C:\Devel

Now couldn't create the devenv's fot Python 2.7 and Python 3.9.1
I get this in Git Bash :

$ virtualenv --python=C:\Python27\python.exe venv2
RuntimeError: failed to find interpreter for Builtin discover of python_spec='C:Python27python.exe'

and :

$ virtualenv --python=C:\Python39\python.exe venv3
RuntimeError: failed to find interpreter for Builtin discover of python_spec='C:Python39python.exe'

The executables are where they have to be, paths are set, but it seems they cannot be invoqued...

This being said, I doubt "C:Python27python.exe" "C:Python39python.exe" mean something ! Some slashes are misssing...

I think there's either a problem with the guide, or a problem with Git

What did you already try to solve it?

Reinstallations, PATH verifications, some Googling

Have you tried running in safe mode?

no

Did running in safe mode solve the problem?

Complete Logs

Not related to OctopPrint, but to the development environment installation

Additional information about your setup

Not related to OctopPrint, but to the development environment installation

Try escaping the backslashes. You can do it two ways:

With quotes: virtualenv --python="C:\Python27\python.exe" venv2

With extra backslashes: virtualenv --python=C:\\Python27\\python.exe venv2

A backslash is a special character in the coding/command line world. For example, \n means new line, so by default they are ignored when you are typing out commands. They can be 'escaped' with more backslashes, so \\ turns into \ when it is interpreted.

1 Like

Thanks ! Yes ! I discovered your answer as I was about to edit my post : out of ideas, I tried with "" : it solved the problem : now the directories are in C:\Devel\OctoPrint, and the installation is now complete. The guide for Windows should be fixed. Sems '\' in " " does not need to be escaped

I feell like I'll be asking for help many times ! Completely new Git and venv's. I use GitHub doing simple uploads, with no versionning. Never figured how to use Git command line and Git GUI...

I have a question. I hesitate. I love Visual Studio (the real one, not Code), and it's on the PC. I also downloaded PyCharm (not installed for now). I could also work remotly on a Pi, for example with Pixel Desktop and VNC. What is the easiest solution for a beginner ?

Easiest solution is by far to work on your local machine. Having done a lot of work with OctoPrint, I got a sponsored PyCharm Pro license that enables remote development, which I needed to create a plugin that uses the GPIO pins on the pi. But this is by no means required for most, most development work is cross-platform compatible.

Working on your local machine is faster, less prone to connection dropouts, easier to debug etc. And simpler to setup the workflow.

For remote development, you can use Visual Studio Code - it has built in remote features for free, that enable SSH, WSL, and something else I can't remember. Not sure that full blown Visual Studio has this , not used it recently.

Obviously, I need access to the GPIO (SPI)...

Had a look to VS Community extensions for RasPi : there are 3 or 4 things I have to read about. Will see also for VS Code... I installed PyCharm, but the OctoPrint tutorial didn't match exactly, and configuration looks complex. (I'm used to another IDE I've been using for 27+ years, since VC++ 1.0 beta...)

Windows development tools for OctoPrint : installation... a pain ! At the end, after half a dozen installations, my venv2 and venv3 folders didn't have any bin folder. Stuck here, and couldn't install cookiecutter. Not even able to get the "venv" prompt anymore.

And Octoprint folders all over the place (root, systme directories and so on) :slight_smile:

But no problems for accesing Octoprint through port 5000.

On the the Pi : did one part from a Putty terminal, and another from LXTerminal in Pixel from VNC, and I think I didn't have any issue. I mean I just played doing things wrong, but everything went right ! (oprint) at the end, and the cookiecutter installed. And took much less time (a few minutes) !

On Windows, years ago, I had to deal with a software that used "Mingwin" (an ancestor of MINGW64 I presume, not sure for the name). I genocided everything that came with after one or two days !

For now, I'm not sure for the directory structures venv's use on the RasPi. But I think I could create Samba shares, edit on the PC with my favourite editor, and run OctoPrint on the Pi with VNC or a dedicated monitor.

I have no complex things to do ; for now, I'd just like a tab with a picture viewer. Nothing more. In your opinion, is this doable this way ? 2 years ago I did so for some scripts, bash and Python, and no problems.