Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while starting new scrapy project

Tags:

python

scrapy

I have installed Scrapy using Ubuntu packages provided in the Scrapy website. But on starting a Scrapy project

scrapy startproject test 

I am getting error message as.

 Traceback (most recent call last):   File "/usr/bin/scrapy", line 5,
 in <module>
     from pkg_resources import load_entry_point   File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3084,
 in <module>
        File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3070, in _call_aside
        File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
        File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 653, in _build_master
        File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 666, in _build_from_requirements
        File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 844, in resolve
      pkg_resources.ContextualVersionConflict: (pyasn1 0.1.7 (/usr/lib/python2.7/dist-packages),
 Requirement.parse('pyasn1>=0.1.8'), set(['pyasn1-modules']))

Please help me solve this error. I am running Python 2.7.6

like image 814
Thirumalesh H S Avatar asked Aug 31 '15 06:08

Thirumalesh H S


People also ask

How do I start a new Scrapy project?

To begin the project, we can run the scrapy startproject command along with the name we will call the project. The target website is located at https://books.toscrape.com. We can open the project in PyCharm and the project folder structure should look familiar to you at this point.

How does Scrapy works?

Scrapy follows asynchronous processing i.e. the requesting process does not wait for the response, instead continues with further tasks. Once a response arrives, the requesting process proceeds to manipulate the response. The spiders in Scrapy work in the same way.

How do you rename a Scrapy project?

Basically, you only need to change default = new_project_title under [settings] in scrapy. cfg file and SPIDER_MODULES = ['new_project_title. spiders'] in the settings.py file to make the spider run with the new name of the project.


1 Answers

According to the error:

pkg_resources.ContextualVersionConflict: (pyasn1 0.1.7 (/usr/lib/python2.7/dist-packages),
Requirement.parse('pyasn1>=0.1.8'), set(['pyasn1-modules']))

The required pyasn1 version should be greater or equal to 0.1.8 and you currently have installed in your global py2.7 dist-packages v0.1.7.

sudo pip install pyasn1 --upgrade will update your current pyasn1 package to the latest version and should solve the problem.

Note: you may wish to check that other projects or applications you have that depend on this library are still functioning correctly.

As a solution to the above notice, please have a look at creating virtualenv's for your python project as this will isolate dependant packages to your project (global ones remain unaffected). more information on virtualenv can be found HERE

like image 150
Roberto Zerbini Avatar answered Nov 15 '22 20:11

Roberto Zerbini