Pycharm default interpreter and tmp working directory on Ubuntu - python-3.x

I use Pycharm for a while now and I'm getting really annoyed that my Pycharm interpreter settings always resets for some reason.
Meaning that whenever I open up a new/old project it will always tell me that:
No Python interpreter configured...
even after I change and apply the settings in
File > Settings > Project: ProjectName > Project Interpreter
or
File > Default Settings > Project Interpreter.
(These changes only apply for as long as Pycharm is open. Once it's closed I need to repeat the whole procedure, which is my problem here.)
Then I noticed that all my projects that I open for some reason end up being opened in the tmp folder.
(e.g. "/tmp/Projectname.py")
Which is also the reason why I cant open recent projects via the menu.
So my question is, how do I actually make Pycharm save my interpreter settings and stop asking me about it.
I know that there seems to be similar questions about it, but either they are not solved or the solution doesn't work. And I hope that this tmp folder thing might be of use to solve this problem.

how do I actually make Pycharm save my interpreter settings and stop asking me about it.
I was having a similar issue when I used PyCharm Community 2017.3 on Ubuntu 16.04 for the first time. The solution was to open the project folder rather than a specific script.

Related

Linux - Eclipse cpp 2019 06 - unhandled event loop exception when opening files

When I install a fresh Eclipse, I can open the program, but when I attempt to create a new blank cpp file or open a file, the program stalls, I get a popup as seen below, and the terminal from which I launched the application looks like the 2nd attached pic. Can anyone help me with this? I'm not sure how to interpret these errors.
Popup:
Terminal:
I solved this myself. In case this comes in useful to anyone else, the answer was found
here
Essentially, before launching eclipse I type:
export GTK_IM_MODULE=ibus
The default value seems to be xim, and apparently is responsible for a number of issues. A small script could be made to automatically do this assignment, and then call eclipse.
This solved my issue.

Adding own files/packages to a custom anaconda environment

I have a custom anaconda environment which I am using to run a program which is dependent on files in another directory. How do I add these files to the environment like I would do with a system interpreter by adding the paths to PYTHONPATH variable in system variables?
I did not need to add the custom files to the virtual environment configuration. I was using the Pycharm Python editor and found a better workaround by adding the paths to the selected interpreter (which in this case was the interpreter for the virtual python environment that I was using).
Go to File —>Settings—> Project: Project name—>Project Interpreter
Next to the project interpreter, click the little gear icon.
Click on Show all. A window should pop-up.
On the right side of the window, there’s a toolbar containing 5 options starting with the plus icon.
Click on the last icon with the file symbol. Another window should open.
Here click on the plus symbol on the top right toolbar.
Go to the directory that you want to include to use in your code and click Ok to add them to the interpreter path.
Repeat for any other directories or files that you may need to have.
This solution with Pycharm worked out pretty well for me since I only needed to reference those files on my computer for that particular project.

Configuring interpreter in PyCharm: "please use a different SDK name"

I have been using Pycharm for years and have never had any problem. However, after my most recent PyCharm update I can no longer configure the interpreter.
Also each time I create a new project it creates a vent directory under my project. When I go to File/Default Settings/Project Interpreter, I am provided with new options.
In this window it allows you to configure a virtual environment, the conda environment, and the system interpreter. I am assuming that I should configure the system interpreter. From there I point PyCharm to the interpreter on my Mac at /usr/local/Cellar/python3/3.6.3/bin/python3 and hit OK.
It then takes me back to the main window where it shows the path in the project interpreter. At this point I hit apply and get a message:
Cannot Save Settings please use a different SDK name
It doesn't matter which interpreter I choose, I get the same message. Has anyone else come up with the same problem and how do I fix this?
Interestingly my old projects still work correctly.
I had the same problem while setting up the virtual environment for my project and no matter if I create a new virtual environment or select an existing one, I get the warning:
"Cannot Save Settings please use a different SDK name"
Finally I found the solution:
Click on the project interpreter dropdown and select show all.... There you might be having multiple virtual environments with same name. Now here is the conflict you need to fix manually by renaming them so every item has the unique name.
I ran into this issue when trying to get docker up and running with Pycharm 2018.1 and using the container's Interpreter. I would get the error below.
"Cannot Save Settings please use a different SDK name"
The issue I had was due to having multiple python interpreters of the same name.
Under Pycharm || Preferences || Project Interpreter
Click "show all" within the Project Interpreter dropdown and then delete any / all interpreters that you don't need.
How fix this in Windows 10:
close Pycharm .
delete this file: C:\Users\<username>\.PyCharmCE2018.3\config\options\jdk.table.xml
open Pycahrm again and load all python interceptors again.
Jon; I too noticed the difference in the latest version of PyCharm. It seems that it now has an affinity for the latest tool 'venv'. When you create an interpreter - that is what you get.
You can still create a virtualenv manually and point it there instead. I haven't looked into pointing it to a base python-bin because (frankly) you shouldn't generally do it.
My advice (and my proposed answer) is to embrace the change and let it create a 'venv' for you. From there, do all of your installs by "alt-F12". That will open a console with your virtual environment activate -- so your PIP installs into the virtual environment.
Once I began using virtual environments, I never looked back. It has made life much easier in the python world. Pycharm seems to know this as well and is trying to really encourage you to do the right thing.
SteveJ
[Edit Alternate way to get to terminal]
This may be a known issue of PyCharm and using the method of the accepted answer may not resolve it. Please see https://youtrack.jetbrains.com/issue/PY-27251.
You can close Pycharm and remove jdk.table.xml file from ~/Library/Preferences/.PyCharm2018.1/options directory (Mac version), then start PyCharm again.
Warning: By doing this, all your existing setup of python interpreters will be erased and you need to re-setup them again.
I had same error:
I deleted all invalid project interpreters ( they are red)
then I did https://stackoverflow.com/a/60583928/3842788
You cannot have 2 or more virtual environments with same name. Even if you have projects with same name stored at 2 different places, please give unique name to its venv. This will solve your problem.
To check all the virtual environments:
Go to File >> Settings >> Project: your_project_name >> Project Interpreter
And rename the venv name.
Go to Project > Project Interpreter > Select the dropdown menu > "Show All".
For me, there were several Python environments, two of which were red with an tag. Remove the envs that are red / have an tag, select the remaining valid one, and re-apply settings.
In my case, I moved my project to a different location and PyCharm started complaining about Cannot Save Settings please use a different SDK name. At the top of the main editor, it asks me to Configure Project Interpreter. I clicked it, and then ...
My solution
Remove all existing interpreters that are marked as invalid in the preference.
Select the interpreter in the moved venv subfolder in my project.
Without doing both, I kept getting the same "SDK name" error. It seemed that the project thinks that it already has an interpreter called "python.exe", if you don't actively remove all "invalid" ones.
I solved this issue by cleaning the Pycharm memory cache

Python IDLE GUI not starting

I feel like I have been coming the internet for days with absolutely no result.
I have taken some web programming classes, and would like to learn some python, just because programming is wicked interesting altogether, and have run into a fairly large hurdle given my experience.
the problem is this: Python.exe (or is is more properly pythonw.exe?) v3.3.3, running on windows 8.1 used to launch fine. Typed up a simple program to roll various sided die, worked out well. Then I changed the key bindings for 'Run Module' from 'ctrl+f5' to 'crtl+alt+spacebar.'
As soon as I did this IDLE crashed and so did the shell. Now the process will not run AT ALL. I cannot access it through the desktop icon to go back and revert the settings. I also attempted to look at the .def files and change it from there but could not find the 'run module' command. It looked like all the key bindings in the .def files were for the shell.
When I double click, nothing, when I run as admin, nothing. run from the start menu, nothing. I uninstalled and re-installed, rebooted, everything low tech I can think of. Now i'm out of my element and could use one of you brilliant social programmers!!
I've found information about checking with some tool called 'Windows Process Manager' some stuff about what to do with the CMD prompt (something about a path problem ...it intuitivly sounds like I very well could have created a 'path problem' but I'm not 100% I know what that is exactly).
I'm sorry for the lack of links, the pages were farther back in my browsing history than I expected. Hopefully i'm not asking an instant many down vote question here, most of the resources online are for either an older version of windows, Lunix, or an older version of python (which is actually where the path problem hint came from)
Thanks any and all greatly for any time spend reading/answering.
Immensely appreciated.
Find file HOME/.idlerc/config-keys.cfg, where on Win7 HOME would be 'C:/Users/yourloginname', and delete the key binding or, if there is nothing else in the file or nothing you want to keep, the whole file.
If you were to run Idle from a console with python -m idlelib, you would probably see an error message. (Yes, you were probably running with pythonw, as when using the start menu or icon. This works better in 3.4.2 and I am working or more improvements.)
I do not know the specific reason for your crash. I set Zoom-height to --space, restarted, and it works, no problem.

SDL in Visual C++ - where to properly put images used in the program?

I'm just learning SDL and I would like to know where is the correct place to put images and other file stuff in?
I use Visual C++ 2010 Express and the problem is that when I compile a program and start it straightly from IDE, it instantly stops because it can't load images. But when I start it by clicking on it in Release/Debug folder, where these images are placed, it is, of course, OK.
It seems that the IDE starts the program from another path than Release/Debug folder.
My question is - how shall I deal with it? Is there a way of setting the location of images directly in Visual C++? I'm asking this question because when I'm unable to start the program from IDE -> I can't use that IDE's debugger.
I hope I explained my situation well enough and thanks for the answers.
If you click on your project with the right mouse button, select properties, on the window that opens, click on "Debugging", notice the entry "Working directory", put there the directory where you want your program to run.
I am used to create a folder called work and put images, sounds, etc, there and configure the working directory to use this folder.
Also, any dlls not in system path must go there for your program to find it or in the same folder where visual is creating your exe.
Also on the same window, you will see the "Environment" entry, you can use it to configure path to dlls if neeeded setting the PATH environment variable, like for example:
PATH=c:\mylibs\dlls\

Resources