IDE autocompletion for Blender again :)

Hey

I am wondering if anyone is able to get Blender Python related auto completion in their IDEs/EDs properly without hacks or fake libs.

Here I assume you installed bpy modules properly under your System’s Python installation. I believe (after I compiled Blender as Py module) installed them right because I can actually import bpy and its derivatives in Ipython and do scene manipulation.

Within all the tools I tested (includes Spyder, Vscode, Vim, Eclipse, Ipython, PyCharm etc) it seems like there are only three tools that does completion to perfection, as in perfect enough that it actually saves time.

First one is Eclipse with Pydev. The second one is Ipython. The third one is Spyder. These three just work meaning that they can traverse well to methods and functions like bpy.context.selectable_objects no problem. And they do not require any further tricks as long as Blender Python installed as module in the Python libs.

All the other tools I tested either fail miserably or waste of time when it comes to code completion for Blender Python.

Vscode: It is a super nice editor, but intellisense and all that jazz is a joke when
it comes to Blender Python. It barely does proper Python completion in my case. Vscode also offers “Jedi” as the completion backend, this works much better but it is slow as hell, like 10 secs per completion, so scratch that as well.

PyCharm: Nice editor but Blender Python is a joke, none, nothing even after adding bunch of Blender Python modules manually.

Vim: My default editor, if you take your time you might be able to get some dictionary, word and Python completion but I was not able to get Blender stuff completed.

I am wondering if anyone outthere got proper Python autocompletion for Blender with the editors that failed in my case. I especially would like to get that working properly in Vscode since it is kind of my default Blender dev environment.

thanks

1 Like

Hi kkar,
How do you do to install bpy module with Spyder, please. I installed Anaconda and open Spyder… then I downloaded the Blender 2.80 module from Nutti github and copyied in C:\Programmdata>Anaconda3>Lib>site-packages>[all contents from Nutti].
But when I write:
import bpy
Ipython answer that:
Traceback (most recent call last):

File “C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py”, line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)

File “”, line 1, in
import bpy

File “C:\ProgramData\Anaconda3\lib\site-packages\bpy_init_.py”, line 1, in
from . import types

File “C:\ProgramData\Anaconda3\lib\site-packages\bpy\types.py”, line 33326
def operator_menu_hold(self,
^
SyntaxError: non-default argument follows default argument

===============================================
I have the auto-completion in Spyder and Ipython now but errors in terminal!

I do not use those fake modules. They never worked that good to me, and sometimes they seem to have typos or missing fields, not sure. I would use them if someone can make it work for VsCode %100 properly.

What you need to do is to compile Blender as Python module which is as easy as compiling Blender. Once you do that just post it here, then I can tell you where the files go.

Compiling Blender Python module is better because you get to have full Blender as module (at least most of it) and you can do actual scene manipulation inside IPython or regule Python console.

1 Like

Thks but how to compile Blender as python module please?

It is same as compiling Blender, please see the Blender wiki for compiling it on Windows. It is the last step that differs, which is below.

Once you have all the settings, fire make bpy 2017 x64 inside the root folder all that Blender files.

1 Like

Is it possible for Linux, ,please? I am on Linux Mint 19,1

Yes naturally building for Linux is even easier , but your error logs showed Windows paths?

If you are trying to compile for Windows from Linux, that is not going to work any more, used to work but they moved to MS compilers.

Yes you are right, Spyder is on my Win 7…Ok I must compile on Win7 absolutely!

If you folllow the Blender Wiki compiling guide strictly, it should work. If it does not work, you missed some steps.

1 Like

I read now the blender wiki guide…it’s very interesting…
so the difference is only this :
make bpy 2017 x64
at the place of :
make

but why 2017 ? we are in 2019.

It is the compiler version

Ha ok I see! Thks a lot kkar!

But these files after this compilation, do you have at your home? If I use your files, is it the same as I compile my-self?
I can download your files and place in Spyder, no?

Well not sure of your Windows version. I can give you the files, I am not around my computer atm. Maybe later. If you wanted now, you need to compile it, or someone else can provide it.

1 Like

Later…I can wait, no problem…

I’ve just spent a whole day trying to make vscode and pycharm work with fake libs, no luck, some things worked, most not.
I tried compiling as a python module and quit after it took 20 minutes and wasn’t even 10% finished… but if you say vscode still sucks then I don’t see the point.
I’m out of ideas but I’m subscribing to this thread in case someone finds a way.

Like I mentioned in my post above, your best bets are (assuming you installed the module alright)

  • Eclipse with Pydev (works nice)

  • Spyder

  • VsCode with Pydev (paid)

Same as you only Ipython works smoothly and is fast. No clues on the other two.

Here it comes. I use VsCode but, as you said, auto compl doesn’t really work. Mind that, anyway, VSCode needs to input its own PYTHONPATH inside the settings, it doesn’t seem to read the one you set by the shell. This is clearly bugged. I remember having made it work sometimes ago but since I always use IPython for my scripting didn’t tried it lately anymore… when I use it inside VsCode I’ve got used not to auto compl at all… :sweat_smile:
By the way if you use VsCode don’t forget to check the extra-useful Blender debugger for vscode if you didn’t that yet…

Trust me, I tried all kinds of PYTHONPATHS and PATHs it still does not work. To be honest I find their intellisense or nonsensenseintellinonsense is a gimmick, it does not even work that good with regular Python stuff. I am dazzled by how Pydev in Eclipse is years ahead of Pyhon integration in VsCode.

If you are going to use Vscode, just disable intellisense it is waste of your resources. Plus I would call it wiretapping, if you did not disable telemetry fully.

You can enable “Jedi” engine in VsCode instead of their borked Python engine, it actually autocompletes Blender library, but it is super sloowwwwww, like 10 secs a completion.

The main reason I started using VsCode becuse of the Blender extension for VsCode developed by @Jacques_Lucke . It is nice, but the lack of proper autocompletion kind of negates that.

I might end up buying the PyDev extension for VsCode, it had much more “intelligent” than MS intellinonsense.

I installed pydev in vscode, does it stop working after 30 days? Is pydev for eclipse the same or free?
How much different is eclipse from vcs?
Second try, compiling blender as python module now, 45% in an hour for just the install_deps.sh script… is this normal??

1 Like