Unable to import netmiko module - python-3.x

I have problem when importing netmiko module. I've installed the python3-pip and trying to import netmiko module
root#Python,Go,Perl,PHP-1:~# python3
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netmiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/netmiko/__init__.py", line 7, in <module>
from netmiko.ssh_dispatcher import ConnectHandler
File "/usr/local/lib/python3.5/dist-packages/netmiko/ssh_dispatcher.py", line 2, in <module>
from netmiko.a10 import A10SSH
File "/usr/local/lib/python3.5/dist-packages/netmiko/a10/__init__.py", line 1, in <module>
from netmiko.a10.a10_ssh import A10SSH
File "/usr/local/lib/python3.5/dist-packages/netmiko/a10/a10_ssh.py", line 3, in <module>
from netmiko.cisco_base_connection import CiscoSSHConnection
File "/usr/local/lib/python3.5/dist-packages/netmiko/cisco_base_connection.py", line 143
msg = f"Login failed: {self.host}"
^
SyntaxError: invalid syntax

As you can see the SyntaxError that you are receiving happens at this line:
msg = f"Login failed: {self.host}"
This is because your Python version is 3.5 while the f-strings were introduced in Python 3.6 with PEP 498. Upgrading your Python version to 3.6 or later will resolve your issue.

Netmiko 3.x.x (and going forward requires Python 3.6 or greater). Netmiko 2.4.2 is the last version to support Python2.7 (or Python 3.5).
F-strings as mentioned above are one thing that will break if you try to use Netmiko 3.x.x with Python 3.5.

Related

ImportError: cannot import name parse_date while importing Pandas

Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/suman/.local/lib/python3.6/site-packages/pandas/__init__.py", line 180, in <module>
import pandas.testing
File "/home/suman/.local/lib/python3.6/site-packages/pandas/testing.py", line 5, in <module>
from pandas._testing import (
File "pandas/src/testing.pyx", line 4, in init pandas._testing (pandas/src/testing.c:4068)
File "/home/suman/.local/lib/python3.6/site-packages/pandas/types/missing.py", line 5, in <module>
from pandas import lib
File "pandas/lib.pyx", line 1, in init pandas.lib (pandas/lib.c:87552)
File "pandas/tslib.pyx", line 67, in init pandas.tslib (pandas/tslib.c:109851)
ImportError: cannot import name parse_date
Make sure that you have installed pandas in the proper directiry:
pip install pandas
If you have already done so, it would be worth upgrading pandas:
pip install pandas --upgrade
Hi I got the same error today when I developed a pyqt project. I found there are two "pandas" when I uninstalled one then tried to install again. What I have done was uninstalling both two "pandas", then install the latest version, then it works. Although I solved this on Windows, but hope it is helpful to you.

How to install nest in Python3 on Ubuntu 18.04

After following the Ubuntu/Debian installation instructions for the Nest simulator I can only import the nest module in python2.x, not python3.x
$ python3
Python 3.6.8 (default, Aug 20 2019, 17:12:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nest/lib/python2.7/site-packages/nest/__init__.py", line 26, in <module>
from . import ll_api # noqa
File "/nest/lib/python2.7/site-packages/nest/ll_api.py", line 72, in <module>
from . import pynestkernel as kernel # noqa
ImportError: dynamic module does not define module export function (PyInit_pynestkernel)
The default install compiles with the default Python version which is still 2 in Ubuntu.
To use Python 3, run:
cmake -Dwith-python=3 -DCMAKE_INSTALL_PREFIX:PATH=</install/path> </path/to/NEST/src>
Mentioned here in the doc.
NB: don't forget to clear the build folder to avoid issues

Why aiohttp import shows below error?

The aiohttp module was installed successfully
But can not be imported as below info
[root#ceph_admin ~]# python3
Python 3.6.5 (default, Jul 1 2018, 23:52:30)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiohttp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/aiohttp/__init__.py", line 6, in <module>
from .client import * # noqa
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 17, in <module>
from . import client_exceptions, client_reqrep
File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 17, in <module>
from . import hdrs, helpers, http, multipart, payload
File "/usr/local/lib/python3.6/site-packages/aiohttp/helpers.py", line 40, in <module>
import idna_ssl
File "/usr/local/lib/python3.6/site-packages/idna_ssl.py", line 1, in <module>
import ssl
File "/usr/local/lib/python3.6/ssl.py", line 101, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
The error above is
ModuleNotFoundError: No module named '_ssl'
So the real problem is my python3 can not import the module _ssl
My python 3.5 was installed from source code. Below are the correct ways to make python 3.5 have _ssl.
1. install openssl-devel by yum(My OS is CentOS)
2. compile your python source code with command (./configure && make && make install)

Pandas module not found, Windows server 2012

All,
I'm running on a Windows 2012 server with Anaconda 2.3.0 64b (2.7) installed and am trying to also have Python 3.6 available. I've installed 3.6 but can't get it to load pandas. I saw another thread that seemed to tie the issue to conda.
I removed and installed pandas again and reset my path to not look at the Anaconda directory but I'm still getting the error.
Any suggestions would be appreciated.
PS C:\Users\yearickp\AppData\Local\Programs\Python\Python36> .\python -m pip list
Package Version
--------------- -------
numpy 1.14.3
pandas 0.23.0
pip 10.0.1
pyodbc 4.0.23
python-dateutil 2.7.3
pytz 2018.4
setuptools 39.1.0
six 1.11.0
SQLAlchemy 1.2.7
PS C:\Users\yearickp\AppData\Local\Programs\Python\Python36> .\python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\__init__.py", line 42, in <mod
ule>
from pandas.core.api import *
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\api.py", line 10, in <mod
ule>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\groupby\__init__.py", lin
e 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\groupby\groupby.py", line
49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\frame.py", line 74, in <m
odule>
from pandas.core.series import Series
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\series.py", line 3978, in
<module>
Series._add_series_or_dataframe_operations()
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\generic.py", line 8891, i
n _add_series_or_dataframe_operations
from pandas.core import window as rwindow
File "C:\Users\yearickp\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\window.py", line 36, in <
module>
import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.
>>>
This seems to be an issue with v0.23. Uninstall pandas pip uninstall pandas and install v0.22 instead pip install pandas==0.22 (except you really have to use v0.23).

How do I configure the sqlite3 module to work with Django 1.10?

So the issue is that apparently Django uses the sqlite3 that is included with python, I have sqlite3 on my computer and it works fine on its own. I have tried many things to fix this and have not found a solution yet.
Please let me know how I can fix this issue so that I can use Django on my computer.
:~$ python
Python 3.5.2 (default, Nov 6 2016, 14:10:16)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
>>> exit()
I figured out that this error was caused by me changing my python path to 3.5 from the default of 2.7.

Resources