Geoffrey Negiar
Geoffrey Negiar

Reputation: 849

Ubuntu can't find Scrapy

I am using Ubuntu 14.04, and I have Python 3.4 and Python2.7 installed. I installed scrapy using

sudo pip install scrapy

and if I try to rerun this, the terminal outputs :

Requirement already satisfied (use --upgrade to upgrade): scrapy in /usr/local/lib/python2.7/dist-packages

But when I try to start a new project, I get this :

$ scrapy startproject tutorial
bash: /usr/local/bin/scrapy: No file or directory of this type

How should I change the path to Scrapy ?

Thanks a lot !

Upvotes: 2

Views: 2979

Answers (3)

Tom Riddle
Tom Riddle

Reputation: 93

I know my answer is too late. I faced this issue today and resolved it so I am adding answer so that it might help someone in future.

It happened because I installed scrapy as local user and not root. When you install it as user with pip install scrapy --user the scrapy script is not copied to /usr/bin. So in order to get it working you need to install it in one of the two ways:

  1. Install as as root by using sudo pip install scrapy
  2. Save this script somewhere in your home folder and run it whenever you ant to run scrapy(I have a ~/.scripts folder added to $PATH in which I store my scripts or just make an alias for the script )

#!/usr/bin/python
   
# -*- coding: utf-8 -*-
import re
import sys
from scrapy.cmdline import execute
if __name__ == '__main__':
  sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
  sys.exit(execute())

Upvotes: 1

Omair Shamshir
Omair Shamshir

Reputation: 2136

First find where scrapy is installed

whereis scrapy

Then add that path to environment variable PATH

lets say its /usr/bin

export PATH=$PATH:/usr/bin

Then you can call scrapy from anywhere.

Upvotes: 4

Rolf of Saxony
Rolf of Saxony

Reputation: 22433

The program installs into /usr/bin

Upvotes: 0

Related Questions