How do I add requests to arcpy 2.78 (ArcGIS 10.3.1)?

929
7
01-18-2018 12:54 PM
TedPrescott
New Contributor III

I can't find pip and can't download any zip files.

Any suggestions?

0 Kudos
7 Replies
DanPatterson_Retired
MVP Esteemed Contributor

python 3.6 and ArcGIS PRO

import requests

dir(requests)
'ConnectTimeout', 'ConnectionError', 'DependencyWarning', 'FileModeWarning', 'HTTPError',
 'NullHandler', 'PreparedRequest', 'ReadTimeout', 'Request', 'RequestException',
.... snip .... 'urllib3', 'utils', 'warnings']‍‍‍‍‍‍

Did you try import requests in python 2.7.x?

or google for a pypi package eg https://pypi.python.org/pypi/requests

0 Kudos
TedPrescott
New Contributor III

My first attempt was just that. But the response was No module named requests.

So, I tried the pypi, but had issues with blocked internet sites.

I was able to download a version, but it says I need pip to install.

pip doesn't come with arcpy 2.78

So, I tried (unsuccessfully) to load pip and/or get-pip.py.

I DID get a copy of setuptools to load, but it doesn't work on the requests install.

Hope this clarifies my problem,

Thanks for the reply

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Sorry, All I have i python 3.6 for Pro and the version of python that comes with ArcMap 10.6 (2.7.???) both come with pip, easy_install and the requests package.

If you are absolutely stuck with ArcMap 10.3, I can't help...

Good luck

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Python 2.7.8, so close yet so far.... Python 2.7.9+ and 3.4+ come bundled with pip, but that doesn't help you.  There are lots of suggestions on installing pip on SO:  python - How do I install pip on Windows? - Stack Overflow .  I would look midway down where folks updated comments in 2016.

If this is a one-off matter, i.e., you are only installing requests and nothing more, you could download the source code from GitHub and manually install it.

0 Kudos
TedPrescott
New Contributor III

How do I manually install it?

Thanks

Ted

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Your question isn't really specific to Esri products, it is a general Python question.  There are other forums/sites that address these types of questions better.

Installing a package manually can be really simple and straightforward or a real headache, it depends on the complexity of the package itself and its requirements.  I have not personally tried to install requests manually; but looking on GitHub now, I see they provide a setup.py file.  The gist of the workflow involves downloading the source code and extracting it, changing directories to the extracted code, and running python setup.py install

0 Kudos
TedPrescott
New Contributor III

Looks like it is the “headache” type.

During the manual install, I get the following error

IOError: No such file or directory: 'README.rst'

So, I think I am going to install 10.5.1 on a spare PC & do the python coding on it.

Thanks for your reply,

Ted

0 Kudos