Help with setting up development environment

Hello,
I have been trying to implement some custom features in Octoprint for various print heads. I only have basic knowledge in Python and one of my friend promised to help me with it. I have tried to set up development environment for Octoprint as per this document,

http://docs.octoprint.org/en/master/development/environment.html#windows

Some of the fields are quite different that what it says in the document
Pycharm version is 2019.2.1 Community edition, and Windows 8

I did everything as per the Document but I'm getting following errors

What's the reason ?

These are the screen shots of run configuration

Since I can't upload all images, I have put them in my drive folder
Here's the link

Thanks
athul

One of the errors suggested that you were trying to run the nosetests and had not earlier installed sphinx.

The pip install ... type of commands need to be run at a command line. And furthermore, it's crucial that you run pip install ... type of commands after you've activated the virtual environment (having followed the instructions).

1 Like

I tried do these steps once again

pip install --upgrade pip
pip install -e .[develop,plugins]

and noticed this error

Collecting wrapt<1.12,>=1.11.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/23/84/323c2415280bc4fc880ac5050dddfb3c8062c2552b34c2e512eb4aa68f79/wrapt-1.11.2.tar.gz
Collecting futures<3.3,>=3.2 (from OctoPrint==1.3.11)
  ERROR: Could not find a version that satisfies the requirement futures<3.3,>=3.2 (from OctoPrint==1.3.11) (from versions: 0.2.python3, 0.1, 0.2, 1.0, 2.0, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1.0, 3.1.1)
ERROR: No matching distribution found for futures<3.3,>=3.2 (from OctoPrint==1.3.11)

When i installed first time I have made some errors. I forgot to add Python to path .So I have uninstalled everything and started once again

There was one error when doing pip install -e .[develop,plugins]

Collecting futures<3.3,>=3.2 (from OctoPrint==1.3.11)
  ERROR: Could not find a version that satisfies the requirement futures<3.3,>=3.2 (from OctoPrint==1.3.11) (from versions: 0.2.python3, 0.1, 0.2, 1.0, 2.0, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1.0, 3.1.1)
ERROR: No matching distribution found for futures<3.3,>=3.2 (from OctoPrint==1.3.11)
(venv)

Here's the complete Bit Bash

New User@Defualt MINGW64 ~
$ pip install virtualenv
Requirement already satisfied: virtualenv in d:\anaconda_python\lib\site-packages (16.7.4)

New User@Defualt MINGW64 ~
$ cd /c/Devel

New User@Defualt MINGW64 /c/Devel
$ git clone https://github.com/foosel/OctoPrint.git
Cloning into 'OctoPrint'...
remote: Enumerating objects: 109, done.
remote: Counting objects: 100% (109/109), done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 60342 (delta 32), reused 69 (delta 23), pack-reused 60233
Receiving objects: 100% (60342/60342), 37.74 MiB | 2.45 MiB/s, done.
Resolving deltas: 100% (39172/39172), done.
Updating files: 100% (745/745), done.

New User@Defualt MINGW64 /c/Devel
$ cd OctoPrint

New User@Defualt MINGW64 /c/Devel/OctoPrint (master)
$ virtualenv venv
Using base prefix 'd:\\anaconda_python'
  No LICENSE.txt / LICENSE found in source
New python executable in C:\Devel\OctoPrint\venv\Scripts\python.exe
Installing setuptools, pip, wheel...
done.

New User@Defualt MINGW64 /c/Devel/OctoPrint (master)
$ source ./venv/Scripts/activate
(venv)
New User@Defualt MINGW64 /c/Devel/OctoPrint (master)
$ pip install --upgrade pip
Requirement already up-to-date: pip in c:\devel\octoprint\venv\lib\site-packages (19.2.3)
(venv)
New User@Defualt MINGW64 /c/Devel/OctoPrint (master)
$ pip install -e .[develop,plugins]
Obtaining file:///C:/Devel/OctoPrint
Collecting flask<0.11,>=0.10.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/db/9c/149ba60c47d107f85fe52564133348458f093dd5e6b57a5b60ab9ac517bb/Flask-0.10.1.tar.gz
Collecting Jinja2<2.9,>=2.8.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/67/ea/92b1d9d8f2dc43302df7f5271b9500bbfc237386782343561a5f62beb306/Jinja2-2.8.1-py2.py3-none-any.whl
Collecting tornado==4.5.3 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/0a/29/01057551db50f718fda2afa0e42abdfccca4f8b18fa6163c59588ae8e991/tornado-4.5.3-cp36-cp36m-win_amd64.whl
Collecting Flask-Login<0.3,>=0.2.11 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/42/3c/ead3f50b8a39b6dd3499ae6f0f5b13b955130c92a7479a287e2e07921faf/Flask-Login-0.2.11.tar.gz
Collecting regex!=2018.11.6 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/68/89/c8791c667486889cbd77a108b9d44bdc2082eb05cd292a51147dd47dbb34/regex-2019.08.19-cp36-none-win_amd64.whl
Collecting Flask-Principal<0.5,>=0.4 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/14/c7/2531aca6ab7baa3774fde2dfc9c9dd6d5a42576a1013a93701bfdc402fdd/Flask-Principal-0.4.0.tar.gz
Collecting Flask-Babel<0.13,>=0.12 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/82/b0/986b29938d4e8be7deb552ebfd1ef16c311276a59bcae10dec567a5b3d20/Flask-Babel-0.12.2.tar.gz
Collecting Flask-Assets<0.13,>=0.12 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/86/ff/6000451570745d7a90847f6528d96d6b24c800eaaf9f26cf398accd8cee5/Flask-Assets-0.12.tar.gz
Collecting werkzeug<0.16,>=0.15.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/d1/ab/d3bed6b92042622d24decc7aadc8877badf18aeca1571045840ad4956d3f/Werkzeug-0.15.5-py2.py3-none-any.whl
Collecting cachelib<0.2,>=0.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/fe/7d/c2d3389034581d077db304c9eb6575ce7e78e36c7e7446c7397820c0c1c4/cachelib-0.1-py3-none-any.whl
Collecting PyYAML<6,>=5.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/76/da/60f8d638d81d64db4ed3c279c22eb3a1eebfcde6130fee678940e603b930/PyYAML-5.1.2-cp36-cp36m-win_amd64.whl
Collecting markdown<3.1,>=3.0 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl
Collecting pyserial<3.5,>=3.4 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl
Collecting netaddr<0.8,>=0.7.19 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/ba/97/ce14451a9fd7bdb5a397abf99b24a1a6bb7a1a440b019bebd2e9a0dbec74/netaddr-0.7.19-py2.py3-none-any.whl
Collecting watchdog<0.10,>=0.9.0 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/bb/e3/5a55d48a29300160779f0a0d2776d17c1b762a2039b36de528b093b87d5b/watchdog-0.9.0.tar.gz
Collecting sarge==0.1.5post0 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/c4/2b/deaaacf4af3f9c45c48be04a6a48fec60515fb34dafda9fe61ecd2c5e4cc/sarge-0.1.5.post0.tar.gz
Collecting netifaces<0.11,>=0.10.9 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/12/20/8dffb210fa8e2c4469dd29120f07bd13f65f83bdde32ab1772f55f441b12/netifaces-0.10.9-cp36-cp36m-win_amd64.whl
Collecting pylru<1.3,>=1.2 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/9c/88/30972cd0518452563221c80bffc2a5832499d736648ef8fe492affae15c5/pylru-1.2.0.tar.gz
Collecting rsa<5,>=4.0 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/02/e5/38518af393f7c214357079ce67a317307936896e961e35450b70fad2a9cf/rsa-4.0-py2.py3-none-any.whl
Collecting pkginfo<1.6,>=1.5.0.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/e6/d5/451b913307b478c49eb29084916639dc53a88489b993530fed0a66bab8b9/pkginfo-1.5.0.1-py2.py3-none-any.whl
Collecting requests<3,>=2.21.0 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting semantic_version<2.7,>=2.6 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/28/be/3a7241d731ba89063780279a5433f5971c1cf41735b64a9f874b7c3ff995/semantic_version-2.6.0-py3-none-any.whl
Collecting psutil<5.7,>=5.6.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/86/91/f15a3aae2af13f008ed95e02292d1a2e84615ff42b7203357c1c0bbe0651/psutil-5.6.3-cp36-cp36m-win_amd64.whl
Collecting Click<8,>=7 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting awesome-slugify<1.7,>=1.6.5 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/34/39/79ef4e640c3651b40de7812f5fcd04698abf14de4f57a81e12b6c753d168/awesome-slugify-1.6.5.tar.gz
Collecting feedparser<5.3,>=5.2.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/91/d8/7d37fec71ff7c9dbcdd80d2b48bcdd86d6af502156fc93846fb0102cb2c4/feedparser-5.2.1.tar.bz2
Collecting chainmap<1.1,>=1.0.3 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/f5/f7/78ddc379d5dc2bbdcf690c3663396d8be5f2c7bc76d30012beef620272ee/chainmap-1.0.3-py3-none-any.whl
Collecting future<0.18,>=0.17.1 (from OctoPrint==1.3.11)
Collecting scandir<1.11,>=1.10 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/a0/c3/8b8244553f4cf8682825e46d264f0bf3b8f7a51c9ba4745c8aa9182da4e5/scandir-1.10.0-cp36-cp36m-win_amd64.whl
Collecting websocket-client<0.57,>=0.56 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/29/19/44753eab1fdb50770ac69605527e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-none-any.whl
Collecting wrapt<1.12,>=1.11.1 (from OctoPrint==1.3.11)
  Using cached https://files.pythonhosted.org/packages/23/84/323c2415280bc4fc880ac5050dddfb3c8062c2552b34c2e512eb4aa68f79/wrapt-1.11.2.tar.gz
Collecting futures<3.3,>=3.2 (from OctoPrint==1.3.11)
  ERROR: Could not find a version that satisfies the requirement futures<3.3,>=3.2 (from OctoPrint==1.3.11) (from versions: 0.2.python3, 0.1, 0.2, 1.0, 2.0, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1.0, 3.1.1)
ERROR: No matching distribution found for futures<3.3,>=3.2 (from OctoPrint==1.3.11)
(venv)

If I understand correctly, it need futures version 3.2.0. but I couldn't install this version, running pip install futures installs only futures 3.1.1

Also In this step “File” > “Settings …” > “Project: OctoPrint” > “Project Interpreter” > “Add local …”, select OctoPrint venv folder (e.g. ~/devel/OctoPrint/venv or C:\Devel\OctoPrint\venv ) , I think it's for the older versions of pyCharm

In newer, File >> Settings >> Project: Octoprint" > Project Interpreter >> "Gear Symbol" >> Add >> New Environment

When I select the OctoPrint venv folder location (C:\Devel\OctoPrint\venv), it says that the "Environment location directory is not empty"

These are the contents of the venv folder

NOTE: I also have other versions (3.x.x) installed. I have an application I made using Anaconda python (3). Would that be a problem

What if you did...

pip install futures==3.2.0

As for your Windows-specific question, I'm not your best help on that. You might tell others what program you're in that has "File -> Settings -> Project..." since that could be Visual Studio or something else. I would suggest that this software thinks that you're making a mistake; that you're trying to create a new project in a folder which already has a project. That's why that step is failing.

If this were trying to create a project folder, VS wants that empty. For example, it might want the plugin folder itself where you're trying to create a (new) plugin.

I am using PyCharm 2019.2.1 Community edition as the IDE (This is what the document says)

I had several other python version 3 installed. I think these were causing issues. After uninstalling everything except Python 2.7.12, I was able to run following successfully

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]

Now only IDE issue



Look to the left of that Add button—it's already populated with what appears to be the correct setting. So don't try to add another one.

Thanks that seemed to be working.
When running "OctoPrint Server" from pyCharm, it runs Octoprint and I can access it by going in to http://localhost:5000/

and this is the screen shot of run >> "OctoPrint nostests"
This is the result

Is this okay ??

I added three run configurations as per the document
Octoprint Server
Octoprint docs
Octoprint nosetests

If I make some changes to the code, what should bet proper procedure to compile and run it ?? I mean which of these should I use

Presumably you'd:

  1. edit some of the code
  2. pip install -e .[develop,plugins] # in that folder
  3. start the server again

In your second screenshot, use "existing environment", as mentioned.

For simple Plugin-Development you only need "Octoprint Server" run configuration in pycharm.
You don't need to switch to a terminal.

Take a look into my "scratchpad": https://github.com/OllisGit/OctoPrint-KnowledgeBase/wiki/Setup-IDE#setup-pycharm

Make sure you add the "External tool: Update dependencies" .This copy your local IDE files to your Octoprint Environment. After that, debugging should also work out of the box.

Good luck...and welcome to the club :slight_smile:
Olli

2 Likes