Configuring Eclipse with wxPython - python

I've been browsing documentation, but haven't been able to find a straightforward tutorial, so I apologize if this is a really simple question.
Anyway, I have eclipse with pydev installed on MAC OSX, and I want configure wxPython to work with eclipse, how do I do this? Once I've downloaded wxpython, what steps do I take to allow wxPython development from eclipse?
Thanks!

Vinay's answer above is correct. However, if code completion is not picking it up, you might need to add the WX directory to the Pydev's interpreter library path.
Window | Preferences | Pydev |
Interpreter - Python | Libraries
If wx is not present, New Folder and select the install directory.

You don't need to do anything special. I'm on Ubuntu rather than Mac, and I've installed wxPython, so that
python -c "import wx"
works at a shell prompt. Then, just fire up Eclipse and create a PyDev project, do import wx in your code and start using the wxPython API. You should get method completion etc. working as you edit your code, and you can also use the debugger and set breakpoints etc.

wxPython install by default to the following path /usr/local/lib/wxPython-2.9.4.0
When adding a path to the Interpreter libraries section in the eclipse preferences add this path:
/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa

Related

Why won't PyCharm see my libraries?

If I do something like "import selenium" (or any other kind of third party library) in a .py file and then run it from the terminal, it works just fine. But if I make a new file in PyCharm CE and do the same thing, it can't find the library / module.
How can I fix this or get it to point in the right location? I use a Macbook Pro.
You need to setup your project in PyCharm to use the Python interpreter that has your libraries:
Go to: file->settings->project->project interpreter
And select the appropriate interpreter from the dropdown. After selecting an interpreter, the window displays a list of libraries installed on that interpreter; this should further help you make the right selection.
I've faced a similar issue on Pop!_OS after installing PyCharm via Flatpak. I think the installation is somehow incomplete, as I've had these issues (among others):
Installer could not create the menu shortcut due to the lack of credentials. Unlike during a typical installation, it wouldn't ask for the password and instead I had to uncheck that option altogether.
Built-in terminal defaulted to sh. Even after changing to bash, it would not read my .bashrc and many commands were missing.
After changing the interpreter into a local virtualenv, it would just default to Python 3.7 (even though the version was actually 3.8) and it didn't see any of my installed libraries.
When I've tried to use a Docker Compose environment, IDE failed to detect Docker Compose installation.
I've eventually uninstalled PyCharm and downloaded it directly from Jetbrains website to make it work correctly.

Eclipse IDE Pydev Import Errors

I am having issues in trying to get the Pydev install in Eclipse to recognise my installed modules such as Beautiful Soup. Within the Preferences > PyDev > Interpreter I have used the Auto Config (which didn't work) and also tried telling Pydev where the Python interpreter is manually. I am on Macosx running Python 2.7.2.
If I import BeautifulSoup within IDLE it works fine. What Eclipse doesn't seem to do is load the site-packages. Going back to the auto-config it loads user/bin/python as the Interpreter and my system path consists of these:
I have tried reinstalling Eclipse, following several tutorials on Youtube and also following other peoples solutions with no success. Can anyone help? Thanks.
When you press the auto-config or add a new interpreter, it'll show a dialog with all the paths it found to be in the PYTHONPATH, but some are not checked by default (it only leaves checked what it believes to be common to all projects -- i.e.: under the python installation), so, try checking if the site-packages appear at that dialog and check it if it's there...
Also, I remember that MacOS has an issue in which it doesn't ship source files for the libraries, so, that may be an issue too (in which case I'd recommend installing a Python version from python.org instead of using the one that comes pre-installed in MacOS).
Try to change proxy settings of eclipse.
Select Active Provider to "Manual". Set HTTP/HTTPS proxy. Clear SOCKS proxy if this is set.(select SOCKS proxy raw and click "Clear" button) Restart Eclipse to apply these settings.

Python OpenGL in Eclipse/Aptana

I am trying to import the OpenGL.GL module.
Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed.
I do have PyOpenGL installed.
I wish to point out that I can still import other modules (PIL, numpy), which were installed the same way as the PyOpenGL. I am confident that there is only 1 python running on my MacOS.
I had the same problem after installing a different version of PyOpen and my Eclipse PyDev path is messed up. What I did was remove the interpreter link and re-added the old one which made PyDev to re-scan my libs. This seems to fix the problem. Don't forget for all your projects, you need to go to the property (Right click project->properties) and re-select the interpreter.
Maybe you need to reconfigure your interpreter.
If you installed PyOpenGL as an egg after pydev was set up your PYTHONPATH might be out of date.
Check out Preferences->PyDev->Interpreter - Python
Are you sure you don't have multiple versions of python? Seems to me like the interpreter that aptana uses is not the same as the one used from command line. You can look in:
Run -> Run configurations -> Python run -- then you have Interpreter tab
There you can click : See resulting command line. Than will get you the python that is used as well as the python path

IDE don't see all the functions

i'm using Elcipse+PyDev and Pyscripter sometimes for Python 2.7
Yesterday i installed PyTables from compiled binaries and :
import tables
h5f = tables.openFile(r'D:\sample.h5','w')
h5f.createGroup('/','Box')
h5f.
So, when I type "h5f." IDE don't show me all the methods, only a few!
Can't do anything with It, installed PyTables few times,same result...
Method h5f.CreateGroup() works perfectly, but IDE dont see it so don't display it in drop-down list! Eclipse and Python both behave same...
The thing with Pydev and Eclipse is that when you install a new package or library and if you want to use the auto-complete with it, you will have to recreate the system PYTHONPATH in eclipse.
For that go to: Window -> Preferences -> Pydev -> Interpreted Python and in the tab libraries, in System PYTHONPATH you will not see your new installed library because pydev just do a copy of the PYTHONPATH the first time that you have configured and now each time you installed a new package you will have to resynchronize pydev with the new PYTHONPATH.
So to resynchronize you will have to click on the button Apply so that eclipse export (again) all the library (between them your new installed one) from PYTHONPATH to eclipse.
So now eclipse should know your library and you should work with it just fine.
Hope this will help :)

How to setup springpython with Jython and Eclipse/PyDev?

I'm having trouble setting up SpringPython with PyDev and Jython
I've installed Spring python by:
jython setup.py install
and the setup installed the library to my jython installation successfully.
See!:
In my PyDev project i've selected the jython interpreter and have c:\jython2.5.1\Lib\site-packages in my Library paths:
My eclipse environment fails to resolve the new classes:
What else do I need to do to install this baby?
Perhaps I should just be using the Java version of spring...
Thanks SO!
The python interpreter that is used to compile your Python files is specified by PyDev on the project level. I suspect that while you do have Jython installed, your Eclipse project (katas) still uses CPython.
Perform the following steps to fix this:
Open your project properties: right-click your project folder ("katas") and select properties
Select tab "PyDev - Interpreter/Grammar"
Switch Python to "Jython"
Your files should now be compiled correctly using Jython.
As noted by the asker himself, you may need to restart your editor (or the Eclipse itself).
Turns out that I just needed to restart eclipse, there you go.

Categories