I am having some trouble with my Eclipse debugger. Every time I set a breakpoint on Python source files, when the breakpoint is hit Eclipse opens up the associated pyc compiled file.
Below are a few things I have tried:
Creating a new Eclipse project with the code
Deleting all settings files within the code
Switch to a new workspace
Re-install eclipse and PyDev completely.
The problem persists. I don't know what could possibly be causing this. The issue only occurs when a breakpoint is set. However, that renders breakpoints useless in Eclipse.
This issue only began after I tried to set up Visual Studio for Python development. In Visual Studio this issue does not occur.
Can you check if you have pydevd installed somewhere in your system and remove it if that's the case? (i.e.: run without debugging import pydevd and if you find it remove it from your interpreter).
The PyDev debugger is used in other products (such as PyCharm and Visual Studio), so, my guess is that a non-compatible version is installed somewhere instead of using the version which is shipped along with Eclipse/PyDev.
Related
I'm sorry if this is trivial, but I'm just starting python and I don't know a lot of terminology so bear with me.
background information:
I just recently changed my IDE from anaconda (Spyder) to Visual Studio Code and I realized that a lot of modules that I installed from pip and used to able to import on Spyder is now unavailable on Visual Studio Code. The only work around that I have been able to come across is to import sys and append the appropriate path to every single one of my project. This is obviously very annoying and is quite a bit of a hassle every time I try to start a new project. Since Spyder works fine for me, I'm convinced that the problems lies in the Visual Studio Code settings instead. But every articles and advices I've came across couldn't give me a straight answer without throwing terminology that I'm unfamiliar with left and right.
Request:
Can anyone help me to permanently append a new python module path to Visual Studio Code so that I don't have to import sys every time?
Thanks in advance!
You can use python interpreter path setting to point to a python installation/ venv
Set the path in .vscode/settings.json
{
"python.defaultInterpreterPath": "path to python.exe"
}
You can follow this for more info.
Python extension has a function called Python: Select Interpreter, which you can get from Command Palette.
If you didn't create virtual environment when using Anaconda, modules should be installed globally, for example python3.9.5.
If you installed modules in virtual environment, Python extension should also be able to detect and show them in the list by click the command Python: Select interpreter. If not, you can manually Enter interpreter path:
Choose the environment where locates your needed modules as the interpreter then you may import them successfully without extra import sys.
More information please refer to Using Python Environments in VS Code.
I am in anaconda dependency hell so I keep building and then deleting different environments and the Visual Studio Code cache seems confused about what environments are available, for example looking for an environment that has been deleted.
I uninstalled and reinstalled VSC (Windows Server 2012 - waiting for upgrade) but the issue persists.
Thanks for any thoughts.
When using Python in VS Code, it recognizes the available python executable file "python.exe", which we can view in the system variables:
In VS Code, it uses the python environment used last time by default, therefore, for unused python environments, you could select other available python environments in VS Code and ignore the deleted python environments. (F1, Python: Select Interpreter)
For more information about the python environment in VS Code, please refer to this document: Using Python environments in VS Code.
Reference: How do I add Python to the Windows PATH?
I am developing in Python using Visual Studio Code. I put breakpoints in the code of an external package in my virtual environment. But the breakpoints are never getting hit. Even by setting the variable justMyCode = false in the VSC settings.
Could there be another reason ?
I encountered the same problem.
The reason is that "The venv folder is not used to store external packages. They must be activated to access the modules installed in them, but the code that uses these libraries should remain external."
The solution is to move the external files with breakpoints out of the virtual environment (like "venv") folder.
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.
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