PyCharm calls packaging_tool.py list again and again - python

I have several user accounts on my linux PC.
Each is running a virtual env in $HOME.
PyCharm works nice in several of them.
But in one virtualenv it constantly uses a lot of CPU. PyCharm does react very slow, and sometimes not at all concerning searches ("find Usage" or "ctrl-shift-f").
Normal editing works fine.
But double-click on a class name to jump to the definition of the class does not work.
I checked what's wrong with the command line tool top.
I see that this gets executed over and over again:
python /snap/pycharm-community/117/helpers/packaging_tool.py list
The process has a new PID every second.
The virtualenv is on a local SSD disk.
What could be wrong here?
Versions: PyCharm 2018.3.5, Python 2.7, Ubuntu 18.04
I removed ~/.PyCharmCE2018.3/ and started again from scratch. Same issue again.
Here is the output of above script: https://pastebin.com/StPqJns6

Related

Pycharm on Mac: why Python SDK cache get corrupted regularly?

This is the massage that Pycharm gives me almost once a day, and I have to restart it. As I have multiple projects open, it gives this error for each virtualenv repeatedly until I force quit it.
Is there a way to prevent Pycharm from constantly invalidating cache?
#ps: I never had such issues with Pycharm on Windows
Invalid Python SDK
Cannot set up a python SDK at Python 3.9 (demographics-g5XoraTQ) (/Users/mamad/Library/Caches/pypoetry/virtualenvs/up-demographics-g5XoraTQ-py3.9/bin/python). The SDK seems invalid.
It turns out the issue was the number of git repositories each with a separate project SDK (i.e. venv interpreter) that I had simultaneously opened in my PyCharm instance (over 10).
The re-indexing of git caches and Python libraries created memory issues and eventually resulted in corruption of index files; this couldn't be solved unless I restarted my PyCharm instance once a day.
The solution was to:
Either re-use one virtual environment for all projects; which is not desirable at all.
Or, as soon as I am done with a project, remove the project along with its Python interpreter and git repository from PyCharm. To speed things up, I set my Poetry to create its .venv inside the project folder; so interpreter and project both can be removed in a single command.
One undesirable outcome of the second solution is that my shell now displays one venv name for all my virtual environments in all project folders.

Arrow up / previous command in VSCode Python Interactive not working

I'm working with VSCode on an Ubuntu 18.04 machine. Everything is fine except that I can't get back to the previous command in Python Interactive Window via Arrow Up. It works in the integrated terminal though, integrated shell is /bin/bash.
I have no idea where this is coming from. I changed "keyboard.dispatch" to "keyCode", but that's not the problem. I also tried different versions of the python-extension.
Do you have any idea?
Thanks!
Not sure if this is helpful for you as an Ubuntu user, but I came across the same problem in Windows this week. In my case, the issue cropped up after I installed the Python extension in VS Code (or at least I didn't notice the issue before this). The combination of using the Python extension, Git Bash for terminal, and python virtual environment killed the up arrow feature for me. Using python outside a virtual environment works fine. My solution was to use Command Prompt as the terminal when I wanted to use a virtual environment interactively.
In my situation, although I delete all the shortcuts of UpArrow, I still can get the previous command through UpArrow in Python interactive. This means there's no way to configure this shortcut, it was built in the plugin which built in Python extension.
So it's some problem with your Python extension, but you said you have tried to install a different version of Python extension but still not work. Make sure you have deleted it completely -> delete the extension folder manually(it's under C:\Users[UserName].vscode\extensions\ms-python.python-xxx).

New python interpreter opens upon importing a package (control)

This is my first post so be gentle! I'm also in the process of learning python independently (trying to make engineering-related webapps using flask).
I have set up a project using virtualenv, and I've used the virtualenv-associated pip (what do I call this?) to install control.
Now, when trying to play around with the control package to play around with it, I am running an instance of the virtualenv's python3 interpreter (I've tried doing this by using the python3 command with the virtualenv activated, and by executing the project's proj/bin/python3 command) and I import control.
Oddly, this opens another python interpreter running on my desktop. Here's the
icon that appears on the mac doc.
Why is this second interpreter opening upon importing the control module?
Thanks for any help!

Python: "No virtualenv active"

I installed PyCharm 2.7 under Windows 8.1. It works fine, but every time I run a program, I get the following warning:
WARNING:root:No virtualenv active
Why does it happen and how can I fix it?
Program you run needs a virtual environment to run. This is a nice python feature that allows you to isolate a python program within the scope of the specific python set of libraries it may need. If you do not run more than one Python program you may not be really worried about it. However, it you do, I would recommend to ready about virtualenv first.
ps. Also, it might be just a debug log for developers to make sure they switched virtual env.

Python console not launching properly from command line

I seem to have problem launching python from command line. I tried various things with no success.
Problem: When trying to run python from the command line, there is no response i.e. I do not get message about 'command not found' and console does not launch. Only option to open python console is to run C:\Python34\python.exe directly. Running using python command does not work even when in the python directory but python.exe launches. Issue with the launching this way is that python console is launched in new window. This whole problem is present only on one machine while on my other machine I am able to run python correctly and console launches in the command prompt window from which the python command was executed.
PATH is correctly set to
C:\Python34\;C:\Python34\Scripts;...
and where python correctly returns C:\Python34\python.exe. I verified that running other commands imported through PATH (such as javac) run correctly.
Things I tried:
Completely re-installing python both with x86 and x64 python installations with no success.
Copy installation from my second machine and manually set the path variables - again no success.
Can anyone hint how to resolve this behavior?
(Additional info: Win 8.1 x64, python 3.4.2)
Issue resolved. Since no feasible solution was found in 2 days, I decided to wipe all keys containing 'python' from registry as well as some files that were not parts of other programs. This resolved the issue after re-installing python.
If anyone finds the true cause of this misbehavior and other - less brutal - solution, please write it here for future reference.
Recent Python installer has option to add PATH.
If you didn't use it, you can register directory where python.exe is to PATH environment variable.
But I prefer py launcher. It may be installed via Python 3.3 or 3.4.
With it, you can start Python via py or py -3.4.
See https://docs.python.org/3/using/windows.html#python-launcher-for-windows

Categories

Resources