Let's set up NetBeans IDE 7.4 to use Python.
Go to Tools | Plugins and the Plugin Manager opens. In the Settings tab of the Plugin Manager, add a new update center with this URL:
http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz
Then go to the "Available Plugins" tab of the Plugin Manager and you'll find Python:
After installing the Python plugin, go to the New Project wizard and create your new Python project or import an existing Python project:
Then have fun with Python:
There's lots of features for Python, including debugging and code coverage.
If you don't expect it to be 100% perfect, you'll be 80% satisfied.
Nice. But it will be difficult for NB as Idea has free python plugin now. If only this was one year earlier ... I know people who got stuck with NB 6.x just because Python support was removed.
Great!...
Hello Geertjan,
Thanks for the post. I downloaded the netbeans about 1 month ago, and I was disappointed when I see that it doesn't support python. As I remember Netbeans had python support on previous releases. Why did Oracle drop support? How old is that plugin you downloaded from deadlock repository? The name "Deadlock" doesn't sound promising for active projects :)
Python support has never been removed, it's always been available. It's stable, no more work needs to be done to it, hence that's why it's not being actively developed. It does what you need it to do, so download it and use it.
"it's stable, no more work needs to be done to it"
Sorry, can't agree. Even simplest things do not work. Autocomplete or go to declaration for example. Without it, IDE is nothing more than a text editor. Rename local var throws exceptions and so on.
class Child:
def mybar(self):
print "bar1"
class Parent:
def __init__(self):
child = Child()
child.mybar()# autocomplete, go to declaration???
if __name__ == "__main__":
p = Parent()
From the screenshots above you can see that autocomplete works. And, yes, it's not perfect. Still, it's hard to say it's nothing more than a text editor when it has a debugger and code coverage, to name just two things, isn't it?
child.mybar()
for method mybar() autocomplete does not work, as well as go to declaration. Without it, it is not really an IDE.
The sad thing is, it did work in netbeans 6.7 if I remember correctly
Somehow having problems getting into my blog at the moment, plus several comments got deleted. Will take a look at this problem, but refuse to accept that without code completion something can't be called an IDE.
"guest", can you drop me an e-mail at geertjan.wielenga@oracle.com? Communication easier via e-mail.
This is great but I think that Python in IDE's (any IDE I know that supports Python) starts from an incorrect assumption.
I mean, when you do Python, you write a script in one file and, when it tends to grow too big, you split off classes to separate files. And when they seem to be usefull in other scripts, they go to separate modules.
I, for one, never start with a 'project' in mind. I just have a big pile of scripts in some directory to do my 'dirty', tinyish work for which I do not want to start a full blown jave or c++ project.
I can imagine that people who write full blown (gui) applications in Python will see it differently. But, for my 'dirty' Python work, it is just overkill.
Sorry - but python support in netbeans proofs, that the saying "The moment you stop working on a software, you've got a bug" is true. It rots - in this case I opened a python file, marked a sequence, pressed some keys and got an exception. I would have expected the marked sequence to be replaced. FAIL.
So while it's nice, that there is potential python support, please don't repeatetly tell people, that python support is in netbeans ...
Really, steps, please. Don't know what "marked a sequence" means. Steps, so I can reproduce it.
0. Create sample file:
#! /usr/bin/python
# -*- coding: utf8 -*-
config = {}
1. Open sample file (outside of a project!)
2. Double click on config to mark the sequence of characters
3. Begin typing
I would have expected that in step 3 the marked sequence is deleted and replaced by the first character I typed in that step.
But I get:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)at org.netbeans.modules.gsf.GsfEditorKitFactory$GsfEditorKit$GsfDefaultKeyTypedAction.replaceSelection(GsfEditorKitFactory.java:299)
at org.netbeans.editor.BaseKit$DefaultKeyTypedAction$2.run(BaseKit.java:1140)
at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:351)
at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.actionPerformed(BaseKit.java:1131)
at org.netbeans.editor.ext.ExtKit$ExtDefaultKeyTypedAction.actionPerformed(ExtKit.java:1024)
at org.netbeans.modules.gsf.GsfEditorKitFactory$GsfEditorKit$GsfDefaultKeyTypedAction.actionPerformed(GsfEditorKitFactory.java:267)
at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:339)
yes, just select a string and start typing. You'll get an IDE exception. And yes, it used to work in previous versions < 7. Python support in Netbeans was "almost there", but I wouldn't recommend it as python IDE right now.
I don't get the error you describe. Anyway, can you drop me an e-mail at geertjan.wielenga@oracle.com? That will help, thank you.
Everyone seems to be complaining, I just want to thank you and everyone who worked on it for the plugin - and the articles
I've been using Netbeans's Python plugin for years, I've tested many other IDE's but none of them was able to replace my Netbeans/Python setup
Yes there are/have been fluctuating minor bugs, but it has always been usable
Anyway thanks
@Geertjan: Ok - so I narrowed it down - what I see is most probably bug #209401 - 22 months ago this was filed. I'll add my comment to that bug.
Use the final release, not some random development build, of NetBeans IDE 7.4. That's what I'm doing and not seeing the problem you describe.
As described in the bugreport (maybe this discussion should be there, as with your explanation you could close the bug as NOTABUG...):
This _is_ reproducible:
Create test.py as:
#! /usr/bin/python
# -*- coding: utf8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
config = {
}
- Download fresh install of minimum Netbeans (Java SE-Build from https://netbeans.org/downloads/ as ZIP download)
That results in netbeans-7.4-201310111528-javase.zip
- Create empty cache and userdirs (no I won't trash my running configuration just for a test!)
- Unzip Download
- Run the fresh copy of netbeans (netbeans/bin/netbeans --userdir c/h --cachedir c/c)
- Accept licence
- Decline import of config from 7.3
- Install all provided auto updatesar
- Restart netbeans as requested
- Add Deadlock Repository (http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz)
- Install _only_ the plugins "Python" and "Jython Distribution"
- Restart netbeans as requested
- Open test.py via File -> "Open File"
- select the word config (double clickinig, by keyboard select (arrow keys while holding shift) or mouse marking (click in front of word, hold left mouse button, move mouse behind word, release mouse button)
- Press key "L"
- You will see a red notification bubble in the lower right corner of the netbeans window
- Clicking that opens the notifications area
- A "Unexpected Exception" is shown, with a priority of silent
I can zip the install dir and you can try it yourself!
Just for the record: I'm not in the habit of judging a system from experimental builds.
Oh and the netbeans install I tested with was also downloaded - do you have reason for you accusation? I took the time to dig the bug report, reproduce it, add additional information AND A PATCH - not sure what more you'd expect.
The bug is fixed - the patch was pushed into the repository. The nightly builds (see link in Geertjans post) already contain the fix.
Please note, I forgot to increment the version number, so the fix won't be available via autoupdate. To fix this, please:
1. Locate your netbeans userdir: http://wiki.netbeans.org/FaqWhatIsUserdir
2. Change into directory "modules"
3. Delete the following files (=> this removes the problematic file and allows reinstallation of python support):
org-netbeans-modules-gsf.jar
org-netbeans-modules-gsf-api.jar
org-netbeans-modules-gsfpath-api.jar
org-netbeans-modules-python-* (Everything, that starts with org-netbeans-modules-python)
4. Reinstall Python support following the steps in Geertjans post.
Thanks to the netbeans team (in this case Milutin Kristofic) who kindly pushed the change, even though its not his module.
Great, well done, and thank you!
Great! I hope, that the Python will be included as standard Language in NetBeans in future! ;)
Can't get auto-complete to work?
Typed
if __n
As in the third screenshot, nothing appears. Fresh install of NB 7.4 with the plugin.
Runs the test ok, just doesn't autocomplete - is there an option required?
Great tutorial! I like Python IDE!
One remark (because it took me hours to figure out what was wrong):
I would recommend to disable the Update Center for Python IDE (http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz) after the Python IDE is installed. In my first attempt, I did not do that. This caused the "C/C++"-plugin to update from 1.24.2.1 to 1.26.0.1. After this update, NetBeans did not function as it should: the "Tools" > "Plugins" and "Tools" > "Options" popup windows from the menu did not work anymore... and some other things did not work anymore... in short, it makes NetBeans unusable...
Is there a Python Shell for this plugin or some equivalent?
Is there a place to contribute to this plugin? It would be great to include Python 3 support or, at least, update the python console to 2.7.x
Awesome, thanks.
thank you, it's really useful
Thanks!Thats very nice topic
Does anyone know why i can't get plugin? Downloading stucks at couple percents.
Mayby someone has same problem?
Thanks so much!
This helped me. Thanks alot.
I felt very depressed when I tried to install python plugin on netbeans. I don't know why the editor always tell me my java version is less than 1.7.0, actully it is 1.7.0. BTW, my netbeans's version is 7.3.1, not 7.4.
Hey.
After i installed the python plugins i cant open the plugin or preferences menu anymore!
The message appears: org.openide.notifydescriptor.isnodefaultclose()Z
Can you help me please!?
greetings oli
Just a quick thank you.
Have been struggling for last few months and then came back to see if there had been any developments.
There have.
I can now move forward again
I'm using Netbeans 8.0, and jdk1.8.0. Following your instructions for Netbeans 7.4, things went smoothly. But when trying to run a Python pgm., I get the following:
\Java\jdk1.8.0\bin was unexpected at this time.
Any suggestions?
Tim Paysen
Sir, We link to extend(https://platform.netbeans.org/tutorials/nbm-projectextension.html) and add some functionality to this Python plug-in. For that, we needed to know the projectType of this plugin. Where can we get it.
Thanks & Regards
Sir, We link to extend(https://platform.netbeans.org/tutorials/nbm-projectextension.html) and add some functionality to this Python plug-in. For that, we needed to know the projectType of this plugin. Where can we get it.
Thanks & Regards
Wow! I am enjoying it! I love you!! :D
What a nightmare it is to execute code and test it?
Is it even possible?
My Netbeans 7.4 crashed after installation of this python.
Now I can't even open the IDE. It hungs on memory and don't open the IDE
Stop using NetBeans IDE 7.4. It's really old. Uninstall it. Install NetBeans IDE 8.0.2 and follow the Python steps here: https://blogs.oracle.com/geertjan/entry/python_in_netbeans_ide_81
From the screenshots above you can see that autocomplete works. And, yes, it's not perfect. Still, it's hard to say it's nothing more than a text edit