Installing scrapy on mac - pyasn1 distribution not found

8.1k Views Asked by At

I have installed scrapy on my mac (OS El Capital, 10.11.4), there does not seem to be any compatibilty problem between scrapy and my python version (2.7.11) but when I try to start a project with scrapy startproject tutorial I get following error message:

pkg_resources.DistributionNotFound: The 'pyasn1' distribution was not 
found and is required by service-identity

I have tried updating both the pyasn1 and the service identity package, but that did not change anything. I have not found any help regarding this specific problem.

Has anyone ever experienced a similar problem? Is there a solution (even a "brutal" one, like uninstalling everything to start from scratch)?

2

There are 2 best solutions below

1
On

There is no need to install everything from scratch. I suggest you to build scrapy in a separate python environment. In my case, a simple pip install cryptography in my environment solved this issue.

0
On

I found that the problem was due to El Capitan getting rid of openssl headers. This was causing cryptography build to fail.

I found the answer by following: Install Scrapy on OS X El Capitan

The important parts are:

brew install openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography  
pip install --upgrade scrapy