ImportError: No module named 'bottle' - PyCharm

PythonPycharmBottleImporterror

Python Problem Overview


I installed bottle on python3.4 with pip install. In terminal, when I do:

$ python3.4
>>>import bottle # shows no import error
>>> 

but when I do it in PyCharm, it says "import bottle ImportError: No module named 'bottle'"

Python Solutions


Solution 1 - Python

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

enter image description here

Solution 2 - Python

In some cases no "No module ..." can appear even on local files. In such cases you just need to mark appropriate directories as "source directories":

Mark as source lib directory

Solution 3 - Python

The settings are changed for PyCharm 5+.

  • Go to File > Default Settings
  • In left sidebar, click Default Project > Project Interpreter
  • At bottom of window, click + to install or - to uninstall.
  • If we click +, a new window opens where we can decrease the results by entering the package name/keyword.
  • Install the package.
  • Go to File > Invalidate caches/restart and click Invalidate and Restart to apply changes and restart PyCharm.

Settings

Install package

Solution 4 - Python

I am using Ubuntu 16.04. For me it was the incorrect interpretor, which was by default using the virtual interpretor from project.

So, make sure you select the correct one, as the pip install will install the package to system python interpretor.

enter image description here

Solution 5 - Python

pycharm 2019.3 ,my solution is below: enter image description here

Solution 6 - Python

I had virtual env site package problem and this helped me, maybe it will help you too enter image description here

Solution 7 - Python

In the case where you are able to import the module when using the CLI interpreter but not in PyCharm, make sure your project interpreter in PyCharm is set to an actual interpreter (eg. /usr/bin/python2.7) and not venv (~/PycharmProject/venv/...)

Solution 8 - Python

I had the same problem, I tried all fixes like installing from the project interpreter and installing from python console, nothing worked. What worked was just going to the project folder from the terminal and installing it from there.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTinno TLView Question on Stackoverflow
Solution 1 - PythonThomasleveilView Answer on Stackoverflow
Solution 2 - PythonIvan TalalaevView Answer on Stackoverflow
Solution 3 - PythonVinay VemulaView Answer on Stackoverflow
Solution 4 - PythonVikas GoelView Answer on Stackoverflow
Solution 5 - PythonMarsYoungView Answer on Stackoverflow
Solution 6 - Pythonibrahim mertView Answer on Stackoverflow
Solution 7 - PythonBruce LeatView Answer on Stackoverflow
Solution 8 - PythonHakunView Answer on Stackoverflow