# USA County Choropleth Maps in Python

**URL:** <https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578>\
**Category:** 📊 Plotly Python\
**Created:** [February 24, 2018, 11:06pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578 "2018-02-24T23:06:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![drissguessous](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@drissguessous](https://community.plotly.com/u/drissguessous)\
**Post date:** [February 24, 2018, 11:06pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/1 "2018-02-24T23:06:35Z")

</div>

I have made sure that the required packages have been installed. Yet every time I get this same error.

ImportError Traceback (most recent call last)  
 in ()  
9 values = range(len(fips))  
10  
—\> 11 fig = ff.create\_choropleth(fips=fips, values=values)  
12 py.iplot(fig, filename=‘choropleth of some cali counties - full usa scope’)

/anaconda3/lib/python3.6/site-packages/plotly/figure\_factory/\_county\_choropleth.py in create\_choropleth(fips, values, scope, binning\_endpoints, colorscale, order, simplify\_county, simplify\_state, asp, offline\_mode, show\_hover, show\_state\_data, state\_outline, county\_outline, centroid\_marker, round\_legend\_values, exponent\_format, legend\_title, \*\*layout\_options)  
563 if not gp or not shapefile or not shapely:  
564 raise ImportError(  
–\> 565 "geopandas, pyshp and shapely must be installed for this figure "  
566 "factory.\n\nRun the following commands in the terminal to "  
567 “ensure that the correct versions of the modules are installed:\n”

ImportError: geopandas, pyshp and shapely must be installed for this figure factory.

Run the following commands in the terminal to ensure that the correct versions of the modules are installed:  
`pip install geopandas==0.3.0`  
`pip install pyshp==1.2.10`  
`pip install shapely==1.6.3`

---

<div class="post-metadata">

**Author:** ![jack](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jack/32/11_2.png) [@jack](https://community.plotly.com/u/jack)\
**Post date:** [February 26, 2018, 4:12am UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/2 "2018-02-26T04:12:57Z")

</div>

@drissguessous Can you please try installing these packages with `pip3` instead of `pip`? If that does not work, can you please try installing these packages using `conda`? If using Jupyter notebook, please restart the kernel after installing the packages.

---

<div class="post-metadata">

**Author:** ![pranu\_kvs](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@pranu\_kvs](https://community.plotly.com/u/pranu_kvs)\
**Post date:** [March 5, 2018, 3:45pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/3 "2018-03-05T15:45:08Z")

</div>

If you have Anaconda, do not use pip, i installed with pip and got the same error, installing it with conda solved it.

conda install plotly  
conda install geopandas

Run the above two commands and it should work.

---

<div class="post-metadata">

**Author:** ![Adam](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adam/32/23418_2.png) [@Adam](https://community.plotly.com/u/Adam)\
**Post date:** [June 5, 2018, 1:38pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/4 "2018-06-05T13:38:58Z")

</div>

Thank you for looking into this and posting a solution.

I will append to the error message to clarify this for other users.

---

<div class="post-metadata">

**Author:** ![JustinG](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@JustinG](https://community.plotly.com/u/JustinG)\
**Post date:** [August 27, 2018, 6:59pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/5 "2018-08-27T18:59:18Z")

</div>

Just letting people know, that these steps don’t in fact correct the issue. I have built a virtual env from scratch and I am experiencing the same issue with modules. I have tried conda, and pip, and pip3. None have worked

---

<div class="post-metadata">

**Author:** ![pes3](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pes3](https://community.plotly.com/u/pes3)\
**Post date:** [September 27, 2018, 3:04am UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/6 "2018-09-27T03:04:48Z")

</div>

Hi Justin, I am having the same issue - you ever find a solution?

---

<div class="post-metadata">

**Author:** ![asp1020](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@asp1020](https://community.plotly.com/u/asp1020)\
**Post date:** [March 11, 2019, 8:10pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/7 "2019-03-11T20:10:38Z")

</div>

I was able to solve this problem by installing pyshp using conda (in addition to plotly and geopandas):

```
conda install pyshp

```

Then following this example:

[https://colab.research.google.com/drive/1T3WgAhyJZBddpAK5z3K3d2laUhH\_zgKq#scrollTo=y3Wgapvd4TLc](https://colab.research.google.com/drive/1T3WgAhyJZBddpAK5z3K3d2laUhH_zgKq#scrollTo=y3Wgapvd4TLc)

---

<div class="post-metadata">

**Author:** ![emily](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@emily](https://community.plotly.com/u/emily)\
**Post date:** [April 22, 2022, 11:28pm UTC](https://community.plotly.com/t/usa-county-choropleth-maps-in-python/8578/8 "2022-04-22T23:28:49Z")

</div>

I tried thousands of solutions. This finally worked!
