So I am trying to submit some coursework for university, but when I compress the project and send it to my friend, he cannot run it.
I noticed at the top of the console there is this line
"/Users/maxculley/Desktop/PART 2/bin/python" "/Users/maxculley/Desktop/UNI WORK/YEAR 3/Data structures and algorithms/Coursework 1/PART 2/CODE/main.py"
I located the files on my desktop and it seems as though I can only run this if the project has these files at that file path.
Anyone know why the project is using these files from two project?
FIXED -- Realised I didn't need to compress the whole folder, just the python files, the interpreter is what was causing the issue as this is what was located on my home screen
I am using PyCharm Community Edition and tried versions 2019.1.3 and 2019.1.2. I can create a new project and files to that project but as soon as I write anything (e.g: in a .py file, in a .html file or even entering the script path when adding a configuration) it crashes (also crashes when trying to edit an already existing project). Any suggestions what I can do to fix that?
Go to Preferences/Appearance and select a different font, I used "Monospace" and things seem to work again.
On my system, PyCharm was crashing when it called into CoreText rendering. Reinstalling and trashing preferences otherwise didn't work.
When I want to run one of our many python scripts I hit run, which creates a new run configuration. The working directory for that configuration is the folder in which the python script file resides. Instead, it should run from a project wide fixed folder. I'd like to set that somehow but I really cannot figure out why, which is a bit odd as I'd expect many people to want to have this functionality.
Do you know how to pull this off?
If you hit the Edit configurations... button in the submenu appearing when clicking on your currently selected run configuration in the top right of PyCharm, you are able to edit the fields (and therefore also the working directory) of Python run configurations by selecting Python from the Templates (also called Defaults in versions pre-2018) and specifying the desired values.
Don't forget to hit Apply/OK before creating new run configurations, which should now contain the default values you specified!
As far as I know, these defaults are local to one project.
See also: https://www.jetbrains.com/help/pycharm/2016.2/creating-and-editing-run-debug-configurations.html
This issue has come up with previous versions of PyCharm (see this SO post and this one), but it manifests somewhat differently in 4.5.
I am trying to add another library to the Python path of my current project. This is an internal library and consists of a bunch of .py files in a different directory from the current project. I carry out the following steps:
Go to File -> Settings -> Project: summary -> Project Interpreter
Click on the gear icon near the top right corner of the screen that appears in the dialog
Select More... from the context menu that pops up
Click on the interpreter I am using
Click on the last of the 4 icons to the right of that, the thing with a folder and arrows, with tooltip "Show paths for the selected interpreter"
Push + in the resulting popup
Use the file dialog to add the path of the library
Having done this, the result is:
Good:
Running the current project code from a Run Configuration works; that is, the external library is picked up in the PYTHONPATH
The added path does not immediately disappear from the interpreter path dialog, as it was doing in 4.0 (see comment to this answer in one of the SO posts mentioned above).
Bad:
Indexing of the new library fails, and all references to the external library are marked as unresolved references in the editor
I have even tried File -> Invalidate Caches / Restart... and pressed the Invalidate and Restart button that appears. After sitting and waiting for indexing to finish, I get the same result. I have been very careful with setting the right path, and it seems to be correct, given that running the code actually works.
Does anyone know of a workaround for this issue, short of adding the external code as a content root?
I ran into a very similar issue. I am working on an OpenStack component, and all third-party libraries were getting marked as unresolved references. It turned out to be because the .tox directory is automatically excluded by PyCharm, which prevents any virtual environments in that directory from getting indexed properly.
To fix this, I went to the Editor > File Types dialog of the Preferences menu, and removed the .tox folder from the Ignore files and folders option.
Checked w/ JetBrains support, they confirmed that the only ways to add external libraries to a PyCharm project are:
Add the library as a Content Root
OR
Open it as separate project in the same window and attach it to your current project
Not the cleanest approaches, as they both basically mean adding the other library's actual code to your project. But they are the only ones at this point.
If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again.
Just follow these steps in order. They assume you currently have the project open in a PyCharm window:
Close your project by clicking on File -> Close Project
Locate your project in the PyCharm file directory
Delete your project's directory
I agree that PyCharm's handling of what should be a very simple procedure is crappy. Maybe this will be improved in the future?
If you want to remove the project from the recent projects list, just highlight the project with your mouse and hit the del key.
This is for PyCharm 2019.1, but I can bet this will work in previous versions.
I am assuming you are in a Unix based operating system (macOs or any Linux distribution). I am also assuming you have currently opened the project you want to remove.
Close the project by going to File → Close Project:
Remove the project from Pycharm's Welcome Window:
Locate your project and delete it, you can use several alternatives, but I encourage you to use the following
$ rm -rf /path/to/your/project/directory
The previous command will work in macOS and Linux. In Windows, you can delete it manually by locating the projects directory using File Explorer.
That's it, the project has been completely deleted!
click the project you want to remove.
menu bar Edit-> Remove from Project View.
Version 2017.2.1
Press Alt+1 to bring the project pane, and make sure you're in
Project view (not Project Files view).
Select the desired project, and choose "Delete from project
view" from the context menu (right click). You can also use Delete
key.
There is a difference between PyCharm projects and the list of recently opened projects (File → Open recent...):
The PyCharm project is simply an arbitrary folder1 with the appropriate .idea subfolder in it.
The list of recently opened projects is simply the list of paths to some of such folders.
PyCharm does not keep the list of all projects, so you may safely delete a project folder (or its .idea subfolder) from your file system.
But if you have a bad luck, the path to your project directory is already listed in the list of recently opened projects, and if you try opening it with File → Open recent..., then
in older version of PyCharm, the deleted folder is re-created (as a new folder with only the .idea subfolder in it),
in newer versions of PyCharm you get the prompt similar as
The path C:\Users\you\PycharmProjects\deleted_project does not exist.
If it is on a removable or network drive, please make sure that the drive is
connected.
with buttons "OK" and "Remove From List", so you may simply remove the deleted folder from the list,
in all version of PyCharm, if you deleted only the .idea subfolder, it is silently re-created (but all your project settings are lost, of course).
To prevent from the uncomfortable consequence of the 1st possibility of using the File → Open recent... to re-create already deleted project, follow e.g. the first two instructions in the Simin Jie's answer.
1 generally a subfolder of the PyCharmProjects folder in your user profile directory (e.g. if you created it with File → New Project... and accepted the offered default path).
Works for Windows and MacOS.
File -- Open Recent -- Manage Projects
Cliek X to delete from Recent Projects
Delete local directory
According to https://www.youtube.com/watch?v=ksbmc0coO4k
In PyCharm 2018 I finally had to resort to deleting .idea folder and the project went away.
Highlight the project with your mouse and hit the del key, which works for me.
In 2021 maybe another way to do it. My problem was in project with user directory (root was /Users) that contains too many not Python files, and it triggers some problems with Git and file index.
What I did:
show hidden files (Cmd + Shift + .),
find .idea directories,
delete all .idea directories.
open PyCharm and add project from correct directory.
That's it.
I had the same issue. My solution was:
Close project.
Rename the folder you want to dissapear
Open pycharm project. A dialog will be shown asking if you want Pycharm remove the folder. Answer: yes.
That is enough.
In version 2017.2.1
File → Close Project
You will be taken to the start-up window, where you can see the projects you've created on the left. You can then delete a project by clicking the cross sign ('x') following the project name.