ModuleNotFoundError: No module named 'meraki'

Solved
Stipriaan
Here to help

ModuleNotFoundError: No module named 'meraki'

I'm trying to get up and running with Python and the Meraki API but can't get it working.

 

I installed Python

 

I installed PyCharm

 

I ran : pip install meraki


The output of "pip show meraki" shows :

> Name: meraki
> Version: 1.22.0
> Summary: Cisco Meraki Dashboard API library
> Home-page: https://github.com/meraki/dashboard-api-python
> Author: Cisco Meraki
> Author-email: api-feedback@meraki.net
> License: MIT
> Location: c:\users\rene\appdata\local\programs\python\python39\lib\site-packages
> Requires: aiohttp, requests
> Required-by:

 

The output of

help("modules")

Does not show Meraki

The command "import meraki" gives me the "ModuleNotFoundError: No module named 'meraki'" error message.
I also tried the "from meraki import meraki" but that gives the same error.


I get the feeling that I need to run another command to get it installed properly.
However there is no documentation explaining this process.
I've googled through several websites to no avail.

Can anybody shed some light on this matter ?

1 Accepted Solution
Stipriaan
Here to help

I finally found the issue.

PyCharm is running my project in a virtual environment.

I copied all the files from \AppData\Local\Programs\Python\Python310\Lib\site-packages to \PycharmProjects\MyProject\venv\Lib\site-packages

Hopefully this solution will help others who run into the same issue in the future.

View solution in original post

5 Replies 5
sungod
Kind of a big deal

Sounds like an issue with your install/set-up, I'd guess the search path in the environment is not set correctly.

 

I'm not familiar with Python on VS/Windows, but try checking the PYTHONPATH setting, see here in the Windows section...

 

https://bic-berkeley.github.io/psych-214-fall-2016/using_pythonpath.html

 

...this page also includes a simple script to tell you the value of the variable, if you run it in VS and then as executable, see if the answers differ.

 

Stipriaan
Here to help

After adding the PYTHONPATH setting nothing works anymore and I get the following error message :

Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "C:\Users\Rene\AppData\Local\Programs\Python\Python310\Lib\io.py", line 54, in <module>
ImportError: cannot import name 'text_encoding' from 'io' (unknown location)

I added a "System variable" PyHome : C:\Users\Rene\AppData\Local\Programs\Python\Python310
I added a "User variable" PYTHONPATH : %PyHome%;%PyHome%\Lib;%PyHome%\DLLs

https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-so-it-finds-my-m...

 

sungod
Kind of a big deal

I'd think you need to add extra things to the existing PYTHONPATH or other variables, rather than add it standalone.

 

I.e. if the one you're adding is overriding the existing one set up by the install, it'd explain why other things stopped working.

 

If the original settings are lost, just repeat the Python install.

 

Then check the value of PYTHONPATH, whatever it is, append the location of the Meraki package, each path in the list is separated with a semicolon ;

 

If you type    pip show meraki    it'll tell you the install path.

Stipriaan
Here to help

I installed Python on another machine to see if the issue is related to my PC.
I did a custom install with all the necessary checkboxes enabled.

Python installs fine.

The PYTHONPATH variable is not created by the installer.

pip install meraki works fine

pip list shows me : meraki 1.22.0

pip show meraki also shows me the details.

When I run help("modules") from python it does not show me meraki.

Adding the paths to PYTHONPATH also has no effect.

I'm about to give up on this.
This is driving me nuts.

Stipriaan
Here to help

I finally found the issue.

PyCharm is running my project in a virtual environment.

I copied all the files from \AppData\Local\Programs\Python\Python310\Lib\site-packages to \PycharmProjects\MyProject\venv\Lib\site-packages

Hopefully this solution will help others who run into the same issue in the future.

Get notified when there are additional replies to this discussion.