Asnim P Ansari
Asnim P Ansari

Reputation: 2487

How to stop pycharm from searching inside virtual environment folder?

I have a .venv folder inside the project root, which has a python virtual environment. When I use the search feature of Pycharm, it also shows the result from this .venv folder. How can I ignore the virtual environment folder from search results?

I tried marking the directory as Excluded, but that didn't help.

Upvotes: 20

Views: 2806

Answers (4)

Jorj
Jorj

Reputation: 2701

I did the above and I still got the search in venv folder. Then I realized that it is a filter I should've use that solves it (mine was Directory):

enter image description here

Upvotes: 0

Nam G VU
Nam G VU

Reputation: 35404

To get the right answer out, thanks others' answers to this OP, the steps to get rid of .venv in find-in-files are

00 add it to mark as excluded

01 clear cache and restart ide

Upvotes: 0

urig
urig

Reputation: 16841

I'm experiencing the same issue: Even though I've marked the .venv directory as excluded, its contents still show up in the "Find in Files" search results.

I've found a workaround for this, though. In my "Project Settings" I define an "Exclude files" pattern like so:

  1. Open the "Settings" window from the "File" menu.
  2. Find and expand the "Project: <your project name>" section on the left.
  3. Under that section click the "Project Structure" sub-section.
  4. At the bottom of the form on the right, enter **.venv** as the value for "Exclude files:".
  5. Click "OK" to confirm and close.

enter image description here

Upvotes: 11

Pavel Karateev
Pavel Karateev

Reputation: 8550

Did you exclude the venv folder? Right-click on the .venv in the project tree -> Mark directory as -> Excluded.

Upvotes: 21

Related Questions