'No 'get_network_driver' in Python3 Napalm on Ubuntu Network Automation Container

I'm currently working on Network Automation Container in GNS3. While I'm trying to use napalm lib, I'm getting either or these two errors:

  • "ImportError: cannot import name 'get_network_driver' from partially initialized module 'napalm' (most likely due to a circular import ) (/root/napalm.py)"

  • "AttributeError: partially initialized module 'napalm' has no attribute 'get_network_driver' (most likely due to a circular import)"

I checked Python version on this machine and it's 3.8.3 so the napalm is supported here. Does anyone know what can cause this error?



Solution 1:[1]

There are 2 probable issues:
1. The nano files you created and saved in the appliance
2. Python - Netmiko - Napalm versions compatibility

Network Automation Appliance (NAA) comes preinstalled with Python 2.7 & 3.8 + 
Netmiko 3.0 + Napalm 2.5.0.

You can see this with >>> pip freeze

Solution:
Use a fresh Network Automation Appliance (NAA) in your GNS3 topology.
Re-install Napalm in NAA with >>> pip install napalm
(This will auto-install Napalm's compatible version of Netmiko)

Check the version of Napalm and Netmiko installed with >>> pip freeze

napalm==2.5.0
netmiko==2.4.2
paramiko==2.7.1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mert Kulac