Search code examples
pythonpycharmpyramid

Import error in PyCharm even though importing from command line works


I am working on a pyramid project in PyCharm. I have all the packages installed and can import them from the command line. however, when i run my application run.py file

This is the line that is failing

    from pyramid.view import (
    view_config,
    )

it fails with

no module named pyramid.view

I know pyramid is installed, and running from pyramid.view import view_config from the command line works, however it completely fails when trying to run the project.

I have tried both the original line and just having from pyramid.view import view_config but neither works.

I am using python 2.7.6 on ubuntu 14.04

Screenshot of project interpreter config

EDIT: I'm just going to blow away my Linux install and put windows back on.


Solution

  • Unsure you have correct interpreter: go to Pycharm Preferences -> Project: [your project name] -> Project Interpreter. See list of packages installed and verify that you have pyramid within that list.

    If you have pyramid installed try to re-open pycharm.

    Install pyramid in your virtualenv:

    source virtualenv/bin/activate
    pip install pyramid