To use [[arcpy]] outside of ArcMap (or other Esri applications in which it is available), set up a virtual environment. Adding `arcpy` to a virtual environment cannot be accomplished in the typical way because it is proprietary software. First, find the executable Python file associated with ArcMap. Mine was located at `C:/Python27/ArcGIS10.4/Lib/python.exe` > [!Note] Note > Rather than set up a virtual environment, you can simply call the ArcGIS python executable from the command line before running your script. > ```bash > C:/Python27/ArcGIS10.4/Lib/python.exe my_script.py > ``` Open the Anaconda prompt in the project's root and type: ``` virtualenv <NAME> python=C:/Python27/ArcGIS10.4/Lib/python.exe ``` The NAME you choose will be created as a directory in the project's folder. Install packages using pip ```python pip install pandas==0.16.1 pip install matplotlib==1.4.3 ``` You can check which versions of pandas or matplotlib your distribution of ArcMap has by using the Python interpreter window in ArcMap. Use these commands. ```python  import pandas  pandas.__version__  import matplotlib  matplotlib.__version__ ``` Next, you'll need to allow this environment to access the `arcpy` module. 1. navigate to the site-packages directory within the Python folder distributed with ArcMap. Mine was at `C:/Python27/ArcGIS10.4/Lib/site-packages/. 2. Copy the file called 'Desktop10.4.pth' 3. Paste it in the virtual environment folder you created (`~<NAME>/Lib/site-packages`). This will allow the environment to resolve where the `arcpy` module is without needing to copy it over. Keep in mind you will still need a license to run this module. ## Relative paths from custom toolboxes `arcpy` cannot parse relative paths (i.e., using `..` and `.`). Instead use `sys.path[0]` to get the path from which the tool was run. `sys.path[0]` always gives the path of the toolbox, regardless of which nested module it is encountered in.