Questions tagged [pycharm]

PyCharm is an integrated development environment (IDE) for Python. It is developed by JetBrains for Windows, Mac OS X and Linux. DO NOT use this tag on questions regarding code which merely happens to be written using PyCharm, use the appropriate language tag [python] instead.

PyCharm is an integrated development environment (IDE) for Python, developed by JetBrains. It is available on Windows, OS X and Linux.

It provides support for common Python frameworks such as Django, Flask, Pyramid and others.

Starting with version 3, a free and open-source edition of PyCharm was released; along with a professional (paid) edition.

If you have found a bug, it is usually better to report it at the public bug tracker.

For more information, browse the following:

  1. The official product page.
  2. The public bugtracker.
  3. Product blog.
  4. Support page.
16686 questions
211
votes
17 answers

PyCharm error: 'No Module' when trying to import own module (python script)

I have written a module (a file my_mod.py file residing in the folder my_module). Currently, I am working in the file cool_script.py that resides in the folder cur_proj. I have opened the folder in PyCharm using File -- open (and I assume, hence, it…
Claus
  • 4,409
  • 4
  • 19
  • 16
198
votes
15 answers

How do I configure PyCharm to run py.test tests?

I want to start writing unit tests for my Python code, and the py.test framework sounds like a better bet than Python's bundled unittest. So I added a "tests" directory to my project, and added test_sample.py to it. Now I want to configure PyCharm…
Joe White
  • 94,807
  • 60
  • 220
  • 330
175
votes
5 answers

How can I tell PyCharm what type a parameter is expected to be?

When it comes to constructors, and assignments, and method calls, the PyCharm IDE is pretty good at analyzing my source code and figuring out what type each variable should be. I like it when it's right, because it gives me good code-completion and…
Joe White
  • 94,807
  • 60
  • 220
  • 330
167
votes
25 answers

Pycharm does not show plot

Pycharm does not show plot from the following code: import pandas as pd import numpy as np import matplotlib as plt ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000)) ts = ts.cumsum() ts.plot() What happens…
Rasmus Larsen
  • 5,721
  • 8
  • 47
  • 79
163
votes
3 answers

How to type hint a generator in Python 3?

According to PEP-484, we should be able to type hinting a generator function as follows: from typing import Generator def generate() -> Generator[int, None, None]: for i in range(10): yield i for i in generate(): print(i) However,…
Jinho Choi
  • 1,841
  • 2
  • 10
  • 12
153
votes
32 answers

How do I activate a virtualenv inside PyCharm's terminal?

I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open…
Chris Cogdon
  • 7,481
  • 5
  • 38
  • 30
149
votes
6 answers

Why does PyCharm warn about mutable default arguments? How can I work around them?

I am using PyCharm (Python 3) to write a Python function which accepts a dictionary as an argument with attachment={}. def put_object(self, parent_object, connection_name, **data): ... def put_wall_post(self, message, attachment={},…
bin
  • 1,625
  • 3
  • 12
  • 10
148
votes
12 answers

PyCharm running way slow

I'm a big fan of PyCharm by JetBrains but I do run into some issues that I thought maybe I'll ask here about. It hangs unexpectedly and this happens often. Overall, its a little bit slow for my taste and I would love some tips on how to increase…
mlnyc
  • 2,636
  • 2
  • 24
  • 29
144
votes
7 answers

Global npm install location on windows?

I'm not 100% sure, but I believe I installed node v5 from the windows installer on both my home and office PCs. On my home PC global installs happen under %APPDATA%: (dev) go|c:\srv> which…
thebjorn
  • 26,297
  • 11
  • 96
  • 138
141
votes
13 answers

In PyCharm how to go back to last location?

Edit: my system had global key map which had overridden PyCharm. Here's the original question: I've tried these answers, but nothing happened: Keyboard shortcut for Jump to Previous View Location (Navigate back/forward) in IntelliJ IDEA For…
Berry Tsakala
  • 15,313
  • 12
  • 57
  • 80
140
votes
21 answers

Pycharm/Python OpenCV and CV2 install error

I've been trying to install both OpenCV and cv2 from both Pycharm and from the terminal as suggested using: pip install --user opencv pip install --user cv2 but I'm getting the following error for them: Collecting opencv Could not find a version…
Sibi
  • 2,221
  • 6
  • 24
  • 37
139
votes
8 answers

pycharm convert tabs to spaces automatically

I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can't convert tabs to spaces…
Vaibhav Mishra
  • 11,384
  • 12
  • 45
  • 58
129
votes
6 answers

ModuleNotFoundError: No module named 'distutils.core'

I've recently upgraded from Ubuntu 18.04 to 19.04 which has python 3.7. But I work on many projects using Python 3.6. Now when I try to create a virtualenv with Python 36 in PyCharm, it raises: ModuleNotFoundError: No module named…
Milano
  • 18,048
  • 37
  • 153
  • 353
129
votes
6 answers

How to select Python version in PyCharm?

I have PyCharm 1.5.4 and have used the "Open Directory" option to open the contents of a folder in the IDE. I have Python version 3.2 selected (it shows up under the "External Libraries" node). How can I select another version of Python (that I…
Cristian Lupascu
  • 39,078
  • 16
  • 100
  • 137
126
votes
3 answers

How to surround selected text in PyCharm like with Sublime Text

Is there a way to configure PyCharm to be able to surround selected code with parenthesis by just typing on the parenthesis key, like when we use SublimText 2?
Alexis Benoist
  • 2,400
  • 2
  • 17
  • 23