<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to install Cartopy in online Notebook in ArcGIS Notebooks Questions</title>
    <link>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279873#M637</link>
    <description>&lt;P&gt;Hi!&amp;nbsp; Just following up.&amp;nbsp; If you are using an ArcGIS Online notebook and not a separate Jupyter notebook, the 'cartopy' module may be unavailable.&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/arcgis-online/reference/available-python-libraries.htm" target="_self"&gt;This&lt;/A&gt;&amp;nbsp;links to the &lt;A href="https://links.esri.com/agol-help/notebooks-runtime-7" target="_self"&gt;currently available python libraries&lt;/A&gt; in ArcGIS Online notebook.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2023 19:50:15 GMT</pubDate>
    <dc:creator>Tyler_M</dc:creator>
    <dc:date>2023-04-18T19:50:15Z</dc:date>
    <item>
      <title>Unable to install Cartopy in online Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1278940#M632</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to use a sample notebook to generate a report from a feature layer in Arc Online/Field Maps, and run into trouble when I try to import Carotpy.&amp;nbsp; I get ModuleNotFoundError: No module named "Cartopy'.&amp;nbsp; After looking around it seems like one solution would be installing conda, though I'm not sure how to do that with an online Notbook and the sample I have does not mention anything about that.&amp;nbsp; I'm new to python and any direction would be greatly appreciated.&amp;nbsp; The code for this is:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import cartopy.crs as ccrs
%matplotlib agg
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.img_tiles import GoogleTiles
​
def create_map(feature):
    fig=plt.figure(figsize=(5,5))
    url = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}.jpg'
    image = GoogleTiles(url=url)
    ax = fig.add_subplot(1,1,1, projection=image.crs)
    ax.add_image(image, 15)
    xmin = feature["geometry"]["x"] - 500
    xmax = feature["geometry"]["x"] + 500
    ymin = feature["geometry"]["y"] - 500
    ymax = feature["geometry"]["y"] + 500
    ax.set_extent([xmin, xmax, ymin, ymax], crs=image.crs)
    ax.scatter(feature["geometry"]["x"], feature["geometry"]["y"],
         color='green', linewidth=2, marker='o'
         )
    io_bytes = io.BytesIO()
    plt.savefig(io_bytes,  format='jpeg', bbox_inches='tight')
    io_bytes.seek(0)
    return base64.b64encode(io_bytes.read()).decode()
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [6], in &amp;lt;cell line: 2&amp;gt;()
      1 get_ipython().run_line_magic('matplotlib', 'agg')
----&amp;gt; 2 import cartopy.crs as ccrs
      3 import matplotlib.pyplot as plt
      4 from cartopy.io.img_tiles import GoogleTiles

ModuleNotFoundError: No module named 'cartopy'&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 20:35:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1278940#M632</guid>
      <dc:creator>PeterDouglas</dc:creator>
      <dc:date>2023-04-14T20:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to install Cartopy in online Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279690#M636</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; Thanks for posting to Esri Community, we're glad to have you here!&lt;/P&gt;&lt;P&gt;It may be easier to install cartopy for importing through the command prompt (if on Windows) or terminal (MacOS/Unix/Linux) rather than directly through the online notebook.&lt;/P&gt;&lt;P&gt;You should be able to use 'pip' instead of the 'conda' command for this in the command line/terminal:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;pip install cartopy&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that, you should be able to import cartopy in your notebook!&lt;/P&gt;&lt;P&gt;I've attached some documentation on cartopy installation, conda, and pip below.&amp;nbsp; Have a good day!&lt;/P&gt;&lt;P&gt;&lt;A href="https://scitools.org.uk/cartopy/docs/latest/installing.html" target="_self"&gt;Installing cartopy&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/conda/conda-docs" target="_self"&gt;conda&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/pypa/pip/blob/main/docs/html/getting-started.md" target="_self"&gt;pip&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 14:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279690#M636</guid>
      <dc:creator>Tyler_M</dc:creator>
      <dc:date>2023-04-18T14:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to install Cartopy in online Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279873#M637</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; Just following up.&amp;nbsp; If you are using an ArcGIS Online notebook and not a separate Jupyter notebook, the 'cartopy' module may be unavailable.&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/arcgis-online/reference/available-python-libraries.htm" target="_self"&gt;This&lt;/A&gt;&amp;nbsp;links to the &lt;A href="https://links.esri.com/agol-help/notebooks-runtime-7" target="_self"&gt;currently available python libraries&lt;/A&gt; in ArcGIS Online notebook.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 19:50:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279873#M637</guid>
      <dc:creator>Tyler_M</dc:creator>
      <dc:date>2023-04-18T19:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to install Cartopy in online Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279927#M638</link>
      <description>&lt;P&gt;Hello Peter,&lt;/P&gt;&lt;P&gt;If you are running the notebook outside of ArcGIS Online, you can use the information that Tyler provided above to install&amp;nbsp;cartopy in a local Python environment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are working within ArcGIS Online, when you open a notebook, the Python environment supporting the notebook editor experience already includes conda, so you do not need to install it on your own. However, as&amp;nbsp;Tyler mentioned, the&amp;nbsp;cartopy library&amp;nbsp;is not included by default. You would need to install the library before you can import and use it in ArcGIS Online.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just ran the command below in a notebook in ArcGIS Online, and I was able to import&amp;nbsp;cartopy with the library installed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;conda install -c conda-forge cartopy&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="2023-04-18_14-20-11.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68321i6FF4DDD6E85ADF6E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-04-18_14-20-11.png" alt="2023-04-18_14-20-11.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that it might take a couple of minutes for this command to finish running, and you would need to run this command to install cartopy every time you start a new notebook session. For example, say you saved and closed the notebook for the day, and when you open it the next morning, you would need to run the command again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Lingtao | Product Engineer for ArcGIS Notebooks&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Apr 2023 21:30:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1279927#M638</guid>
      <dc:creator>xlt208</dc:creator>
      <dc:date>2023-04-18T21:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to install Cartopy in online Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1281394#M640</link>
      <description>&lt;P&gt;This appears to have worked, thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 17:35:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/unable-to-install-cartopy-in-online-notebook/m-p/1281394#M640</guid>
      <dc:creator>PeterDouglas</dc:creator>
      <dc:date>2023-04-21T17:35:49Z</dc:date>
    </item>
  </channel>
</rss>

