0

I'm a beginner in programming. I made a script that allows me to create and export maps in a full automatize way in PyQGIS. My goal here with this API, is to add some data with the "siret" number on each maps.

But even before I could try to do that, I'm stuck after the installation of this API in a terminal. I'm following this site to help me.

As you can see, installation is fine :

C:\Users\Nathan>pip install api-insee
Requirement already satisfied: api-insee in c:\users\nathan\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.5)

So after that I'm going on PyQGIS, and write the script found in the same site as mentioned before (my consumer and secret keys are fine too) :

from api_insee import ApiInsee

api = ApiInsee(
    key = # consummer key,
    secret = # secret key
)

And you saw that coming, when I execute it, it's not working. The error message tells me that :

ModuleNotFoundError: No module named 'api_insee'

I'm absolutely don't know why I got this error. So I wonder, am I missing something?

Nathan25
  • 1
  • 1

2 Answers2

0

QGIS ships a python interpreter for itself. It doesn't recognize packages installed via your default python installation.

You seem to be on windows, so one way to install a package would be to find the OSGeo4W shell (OSGeo4W64.bat), which is located in the QGIS installation folder. Open it, then execute:

  1. py3_env
  2. python -m pip install api-insee
CodeBard
  • 256
  • 2
  • 4
0

if you want to automatize the production of maps with data coming from SIRENE database which stores data on all French companies, I would advice you to use pynsee python package available on Pypi since October 2022. Pynsee makes it easy to retrieve data from SIRENE database and provides geographical limits of French administrative areas using IGN API with pynsee.geodata.get_geodata function.

It is required to first subscribe to api.insee.fr and to use pynsee.utils.init_conn function to save your credentials. Then pynsee.sirene.search_sirene might help you to download data from insee SIRENE's API.

I made several examples using pynsee and geopandas.

  • Insee premises location here
  • General Practioners in Parisian departements here
  • Automotive industry sites here