Environment setup and plug in source location

Hello,

I am new here. I just installed what was recommended for development (Python, Git, PyCharm, etc). I'm on windows and it all went as described on the instructions except for one line :

source ./venv/Scripts/activate

'source' did not seem to be a recognized command. Not sure the implication, as the rest of the setup seemed to proceed. Other hiccup is that during the Pycharm install, it seems to have created a second venv folder called 'venv1'. Again not sure the impact. I used the first one during the setup the configurations .

Anyway, my question is not so much about that. My intention is to work on a plugin, I am not really a programmer so I will have to learn everything as I go. Please bear with me. I have added a couple plugins to the install, one of which I am intending to adapt to my purposes (thanks ntoff!), however, the plug in code does not show up in the octoprint folders. It seems to have landed in C:\Python27\Lib\site-packages\ Is this normal? Seem not.

Thanks,

Dave

source ./venv/Scripts/activate is a *nix shell command. I'm not very familiar with the Windows setup but I found this and it seems like you should have a bat to run.

Yep plugins will be installed as a python package via pip.

Quick update, the windows setup guide was moved into this very forum:

https://discourse.octoprint.org/t/setting-up-octoprint-on-windows/383

The development guide however explicitly says to use Git Bash instead of the regular windows command line, in which case source ./venv/Scripts/activate actually does what it should:

Open the Git Bash you just installed and in that:

pip install virtualenv
cd /c/Devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/Scripts/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
2 Likes

Feeling quite dumb at moment. My error is that I was following the install guide line by line, but was apparently scrolled back in the window and copied the command from the Linux section, which indicate the script was in the 'bin' directory not the 'scripts' directory. Should be set now I think. My plan is to develop the plugin on my windows machine and them move to the pi once I think it is close to a working option and then finish it there. More about access to the hardware and schedules and life than anything else. Thanks very much everyone for the help!

No worries, happens :slight_smile:

That plan should btw work just fine, it's how I do it myself :wink:

I am still trying to get the environment set up properly. I posted to the plugins area as well, but it seems more appropriate here, and it is likely a continuation of this same problem. Based on the setup guidance when the virtual environment is activated, should I expect to see the prompt change to to reflect the (venv)? It does not, it continues to show (Master).

I mentioned in the other post that my plugin (Helloworld from the tutorial) is not functioning fully. The logging entries are working. The other aspects (the settings dialog, and the URL in the banner) do not. Is this related in some way to the virtual environment no activating?

FWIW, I uninstalled and reinstalled all of the development components but there was no change. I am running on Windows 10.

Thanks in advance.

Still plugging away at this. I believe I figured out the virtual environment activation problem. I am using Git Bash, but when running the source command, it seemed like it was doing nothing. I renamed the activate.bat file to "hide" it and that seemed to do the trick and it ran the activate bash script instead. Prompt changed anyway. Now the problem is that the cookiecutter script will not run (unrecognized command) to create a new plugin. I have cookiecutter installed in both the python environment and in the virtual environment (according to the output from the install command when run from either before or after activating the virtual environment. The 'octoprint --help' show dev as a command, but not dev plgin:new. Is this normal?

plugin:new will only show up if it's found cookie cutter. So that sounds like something is still odd.

I'm a bit busy with fixing some stuff found in 1.3.7rc1 right now, but in general I can tell you that this is basically how I've setup my own development environment under Windows (and that also mirrors the instructions in the plugin tutorial).

I keep a Git Bash open at basically all times, with activated virtual environment via source venv/bin/activate (just activate, no bat), and that gives me the (venv) prompt addition. I've installed OctoPrint plus development and plugin development dependencies into that via pip install -e .[develop,plugins].

This is what octoprint dev --help gives me as a result:

$ octoprint dev --help
Usage: octoprint dev [OPTIONS] COMMAND [ARGS]...

  Additional commands for development tasks.

Options:
  --help  Show this message and exit.

Commands:
  plugin:install    Installs the local plugin in development...
  plugin:new        Creates a new plugin based on the OctoPrint...
  plugin:uninstall  Uninstalls the plugin with the given name.

Thanks for the response. I got it. Not exactly sure what made the difference is but it executed.

Best of luck on the new release!