6

How do I remove all traces of legacy projects from PyCharm?

Background: I upgraded from PyCharm Community Edition to PyCharm Pro Edition today. Reason was so I could work on Django projects, and in particular, a fledgling legacy project called 'deals'.

I deleted the legacy project folders.

I then opened the Pro Edition and went through the steps of creating a Django project called 'deals' with a python3.4 interpreter in a virtualenv.

It didn't work, I got an error message saying something about a missing file, and in the PyCharm project explorer, all I could see was

  • deals

    .ideas

So I deleted it (ie. deleted the folders in both ~/.virtualenvs/deals and ~/Projects/deals).

I tried again, although this time I got an interpreter with a number suffix, ie. python3.4 (1). I continued, and got the same empty file structure.

I deleted both folders again, went and cleaned out the intepreters in Settings > Project Interpreters .

I then tried again, getting 'new' interpreters,until I finally had python3.4 (5) Plus, along the way I also invalidated the caches and restarted. (ie. File > Invalidate Caches/Restart)

Then to prove if it works at all, I tried a brand new name 'junk'. This time it worked fine, and I could see the Django folders in the PyCharm explorer. Great.

But I really want to work on a project called 'deals'. So I deleted all the 'deal's folders again, and tried to create a deals Django project again. Same result.

After googling, I went to the Settings > Project Structure > + Content Root, and pointed it to the folder at ~/.virtual/deals.

Ok, so now I could see the files in the virtual env, but there's no Django files, and plus, the project folder was separate to the virtualenv folder, eg

  • deals

    • deals (~/project/deals) <- separate
    • deals (~/.virtualenvs/deals) <- separate

      • deals

        init.py settings.py urls.py wsgi.py

      manage.py

Really stuck now.

Any advice on how to get this working please? Eg. how do I

(i) get it back to 'cleanskin' so that I can start up a Django project and get the proper folders in the project space.

(ii) get it working with virtualenv, and ensure that the interpreter doesn't have a number suffix, such as python3.4(6)

Many thanks in advance,

Chris

3 Answers 3

13

You can clean out old PyCharm interpreters that are no longer associated with a project via Settings -> Project Interpreter, click on the gear in the top right, then click "More". This gives you a listing where you can get rid of old virtualenvs that PyCharm thinks are still around. This will prevent the "(1)", "(2)" part.

You don't want to make the virtualenv into the content root. Your project's code is the content root.

As a suggestion:

  • Clear out all the registered virtual envs

  • Make a virtualenv, outside of PyCharm

  • Create a new project using PyCharm's Django template

You should then have a working example.

Sign up to request clarification or add additional context in comments.

4 Comments

thanks for looking at this Paul. Your last suggestion unlocked my mindset and did the trick. I created the virtualenv, and then created the project using PyCharm and linked it to the virtualenv. I'll see if I can delete all those suffixed interpreters now...I had tried cleaning out the intepreters in Settings > Project Interpreters, but it didn't work. Dunno why they persist. I had also tried setting the interpreter to the first one, without a suffix, but it blew up too. Anyway, all good for the time being, many thanks again for your comments, much appreciated!
When you define an interpreter, you are defining it at the IDE level and connecting it to a project. It might be used in other projects. Thus, "deleting" it from a project, just disconnects it from that particular project. The interpreter is still registered with PyCharm.
Thanks Paul. For the suffixed interpreters, I found a blog piece here plus a SO question at this link which suggests it is a bug, and shows how to edit the source file. If links are broken, the config file default path is ~/.PyCharm50/config/options/jdk.table.xml (replace 50 with your version). Remove duplicates via sub-elements <name value="your duplicate name"> and delete entire <jdk> tag.
More... has been benevolently renamed Show All....
1

In addition to the answer above, which removed the Venv from the Pycharm list, I also had to go into my ~/venvs directory and delete the associated directory folder in there.

That did the trick.

Comments

0

When virtual env is enabled, there will be a 'V' symbol active in the bottom part of pycharm in the same line with terminal and TODO. When you click on the 'V' , the first one will be enabled with a tick mark. Just click on it again. Then it will get disabled. As simple as that.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.