Importerror: No Module Named 'Bottle' - Pycharm

ImportError: No module named 'bottle' in PyCharm

in your PyCharm project:

  • press Ctrl+Alt+s to open the settings
  • on the left column, select Project Interpreter
  • on the top right there is a list of python binaries found on your system, pick the right one
  • eventually click the + button to install additional python modules
  • validate

Sample Image

PyCharm: ImportError no module named X?

SHORTER VERSION:

If you have squiggly line below module you import...

No Module found

...move on name of module and press Alt+Enter and select Install package X.

Install package X

This should (probably !!!) install module you thought you installed, but got ImportError.


LONGER:

If you want to use module X:

Go to File -> Settings -> Project:NameOfProject -> Project Interpreter.

Project interpreter image

The window that opens has some specific regions:

  1. This is a project interpreter PyCharm is currently using. You can change you python environments here also. If you want to add virtual environment you created manually, continue reading.
  2. A little "cog" or a "gear" is used to Add, Edit or Remove environments. If you want to add virtual environment you created manually, select Add... when gear icon is clicked, and make sure to set proper path to python.exeof your virtual environment.
  3. IMPORTANT: A list of all installed packages, represented by: Package name and Version. If you tried to use package, but got ImportError no module named 'X', make sure to check if package is listed here!!!. If not, it's not installed in the current python environment and it should be installed (continue reading).
  4. A little + represents Install. It can be used to install packages. Simply click on + sign, search for a package and click Install Package at the bottom after you found it. You can also specify the version you want of a package. In example below, we searched for flask package.

    Package installation
    A package should be installed and listed now in installed packages.

Python - No module named my_module in terminal, but not in PyCharm

The PYTHONPATH in your terminal environment doesn't contain 'my_module'.

Configure the PYTHONPATH to include the directory containing your module

It works in pycharm because it sets up the path for you automagically.

Learn about the module search path



Related Topics



Leave a reply



Submit