Adding python packages to ArcGIS?
In your answer screenshot you opened the python interpreter in your command prompt by typing python
. This is similar to the ArcGIS (or QGIS) python consoles. This is where you can write python code, but it is not how you install new python packages.
To install a new package, all you need to do is run pip install <package name>
from within your command prompt (not the interpreter). If you have your PATH variable updated correctly (sounds like you do, with C:\Python27\ArcGIS10.4\Scripts
included) you should be able to run pip install pykalman-master
in the cmd from any directory.
If this doesn't work, please update your answer with the errors you encounter.
EDIT: I just tried installing pykalman-master
and that is the wrong package name. Use this instead
pip install pykalman
EDIT 2: I see your updated error message. You have pip installed correctly, and you have the path set correctly, so no worries about any of that. This is clear because "Collection pykalman" is printed to the console (meaning pip is working).
The issue in this case seems to be a firewall on your network that blocks access to the pypi server where pip looks for python packages. Here are other people with similar problems.
This is really beyond the scope of GIS Stack Exchange at this point, but to save you time digging through forums and to give a little bit more context......
You could either talk to your network admin to open the firewall (and once you read the rest of this you may see why that would be worth it), or you could download the pykalman source code and install it directly. This is really not so hard (don't be intimidated! :) ):
- go to the pykalman repo here https://github.com/pykalman/pykalman
- download the zip file of the repo
- upzip anywhere on your file system
- in a command prompt, enter the unzipped directory, the one that contains
setup.py
run this command
python setup.py install
which tells python to run the setup.py file, and install the package into your python site-packages directory.
- you can now delete the downloaded zip file and the unzipped contents if you want (all the relevant stuff is now in site-packages).
To test that you have installed pykalman (or any python package), run the python interpreter (python
) and try import pykalman
. If no errors, you are good to go.
HOWEVER: The problem with installing this way is that it won't automatically install all of the other python packages that are pykalman's dependencies (numpy
scipy
Sphinx
numpydoc
and nose
). I'm pretty sure ArcGIS's python install comes with numpy
and scipy
, but I doubt you have the others. Meaning, you would likely have to manually install those packages too.
Good luck!
To install using pip
, if it is correctly installed, I think all that you need to do is:
- Make sure that
C:\Python27\ArcGIS10.4
is in yourPath
environment variable - Use
python -m pip install <module>
from acmd
tool
I did the procedure for QGIS but it's the same for ArcGis. My goal is to install 'rdp' (Ramer-Douglas-Peucker algorithm) third party python module. First, run your command prompt application as Administrator. In console, I ran this command:
python -m pip install rdp
At the next image you can see that it was successfully installed.
It's also observed that the package was installed in:
C:\Python27\Lib\site-packages
Edit your PYTHONPATH and copy above text in your 'Environment Variables'. Save changes.
Now, when I launch the QGIS application, 'rdp' is already disponible for the Python Console: