Kirollos M. Dawod
Kirollos M. Dawod

Reputation: 13

Scrapy with Pycharm "ImportError: No module named settings"

I'm trying to get passed this error:

Traceback (most recent call last):
  File "/Users/kdawod/.virtualenvs/python2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 168, in <module>
    execute()
  File "/Users/kdawod/.virtualenvs/python2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 109, in execute
    settings = get_project_settings()
  File "/Library/Python/2.7/site-packages/scrapy/utils/project.py", line 68, in get_project_settings
    settings.setmodule(settings_module_path, priority='project')
  File "/Library/Python/2.7/site-packages/scrapy/settings/__init__.py", line 292, in setmodule
    module = import_module(module)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named settings

It's only happening while running in PyCharm, however, it was working just fine the previous day.

I would be glad if you can help me figure out this issue and prevent it from happening in the future.

Upvotes: 1

Views: 2318

Answers (1)

eLRuLL
eLRuLL

Reputation: 18799

this is because Pycharm isn't finding the correct scrapy installation because it is trying to use the system's python version.

As you are using virtualenvwrapper outside Pycharm, you also need to define that inside. You have to specify the path of the python installation inside your virtual environment.

To select it in Pycharm go to:

Preferences -> Project: myproject -> Project Interpreter

and then select Add Local on the gear close to the upper-right corner which will help you browse where the correct python installation could be.

Upvotes: 4

Related Questions