Himanshu Bhandari
Himanshu Bhandari

Reputation: 1879

Unable to install scrapy

I am trying to install scrapy and for that I have installed python 2.7 and conda(as pip was giving me errors that i couldn't solve.) after that I created a separate environment for scrapy named py2 with conda.

With this output I suppose that scrapy is installed successfully on my machine.

[py2] C:\Users\ADMIN>conda install -c https://conda.anaconda.org/scrapinghub scrapy
Fetching package metadata: ......
Solving package specifications: ...........................
# All requested packages already installed.
# packages in environment at C:\dev\Anaconda3\envs\py2:
#
scrapy                    1.0.3                    py27_2    scrapinghub

Now I make it sure that it is python 2.7 I executed this

[py2] C:\Users\ADMIN>py
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Which is also correct I suppose.

Now still I am unable to do this

>>> import scrapy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scrapy

which indicates that scrapy is not installed.

Environment : Windows 8 (64 bit) I am a beginner both in python and scrapy.

Upvotes: 0

Views: 1650

Answers (2)

Himanshu Bhandari
Himanshu Bhandari

Reputation: 1879

As it was all in virtual environment of conda, while installing scrapy I needed to pass the name of conda virtual environment, except that scrapy would have been installed in the root(I mean outside the environment or for the machine.)

So for py2 virtual environment, after activating this, following command will install scrapy:

conda install -n py2 -c https://conda.anaconda.org/scrapinghub scrapy

Here py2 is environment's name.

This page helped me to figure out what was happening here.

I must say python is not that easy to learn.

Upvotes: 0

Turo
Turo

Reputation: 1607

There are interestingly a few hacks that are needed to run Scrapy on Windows.

You would need to install unofficial support for Windows in Python, look for PyWin32 section: http://www.lfd.uci.edu/~gohlke/pythonlibs/ Afterwards remember to run postinstall.py -install as advised on this page.

Depending how you are setup, you might need to install C++ compiler for Python, required to run lxml: https://www.microsoft.com/en-us/download/details.aspx?id=44266

Please look for similar questions referring to overall Python not only Scrapy e.g. error: Unable to find vcvarsall.bat Depending on how you are setup you will find hints around.

Upvotes: 1

Related Questions