>>> from netmiko import ConnectHandler
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\netmiko\__init__.py", line 7, in <module>
Hello Experts,
Post applying from netmiko import ConnectHandler command I am getting above error.
Setup - Windows 10, Python 3.7, Netmiko installed. no other file present in pc with name netmiko.py.
Please suggest solution.
In order to use Netmiko, you need to be in the same python environment that you installed netmiko.
I see you installed Windows 10 and Python 3.7, but the python that is being used to call Netmiko is 2.7. You can tell from the "Python27" in the directory name C:\Python27\lib\site-packages\netmiko\__init__.py.
Run a Python 3.7 shell and try the command again. Make sure Netmiko is properly installed in the environment.
To verify if netmiko is installed, type help("modules") to retrieve a list of all installed packages. If Netmiko was properly installed, you should see it there.
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")
Please wait a moment while I gather a list of all available modules...
---- output omitted ----
Cryptodome bdb gc pyexpat
__future__ binascii genericpath pygments
_string codecs netaddr tabnanny
_strptime codeop netapp tarfile
_struct collections netmiko telnetlib
_symtable colorama netmiko_globals tempfile
_testbuffer colorsys netrc terminal_server
_testcapi compileall nntplib test
_testconsole concurrent nt textfsm
_testimportmultiple configparser ntpath textwrap
_testmultiphase contextlib nturl2path this
_textfsm contextvars numbers threading
I hope this was helpful
Run : python3 to access python version 3.5+ terminal.
>>>from netmiko import ConnectHandler
Related
I installed Anaconda and activated the environment. When I attempt to run a python script which imports numpy in Visual Studio Code I am facing the following error:
(base) C:\Users\UserX\python test.py
ModuleNotFoundError: No module named 'numpy.core'; 'numpy' is not a package
Traceback (most recent call last):
File "test.py", line 1, in <module>
import numpy
File "C:\Users\UserX\numpy.py", line 2, in <module>
import matplotlib
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
_check_versions()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 159, in _check_versions
from . import ft2font
ImportError: numpy.core.multiarray failed to import
I have no issues with running the same directly:
(base) C:\Users\python
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
Conda info confirms the same python version in use...
(base) C:\Users\UserX\conda info
active environment : base
active env location : C:\ProgramData\Anaconda3
shell level : 1
user config file : C:\Users\UserX\.condarc
populated config files : C:\Users\UserX\.condarc
conda version : 4.9.2
conda-build version : 3.20.5
python version : 3.8.5.final.0
the chosen python interpreter is the one installed with Anaconda and no other version of python exists.
C:\ProgramData\Anaconda3
I tried reinstalling numpy, matplotlib, Anaconda, Visual Studio Code, deleting Anaconda directory and any other potential solutions I could found with a search engine. Is there anything obvious I am missing here?
Actually, I missed an important fact that another file within the same directory had a name numpy.py which was causing issues as per the error message. Oh boy... I should have noticed that earlier. I have renamed the file and the issue is resolved.
File "C:\Users\UserX\numpy.py", line 2, in <module>
Python 3.7.1 on Ubuntu 18.04.2 LTS
Using Pycharm version:
PyCharm 2019.1.3 (Professional Edition)
Build #PY-191.7479.30, built on May 30, 2019
Linux 4.18.0-22-generic
I'm having issues with the os.get_terminal_size() function call
Running the command from the terminal window works:
Python 3.7.1 (default, Oct 22 2018, 11:21:55)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.get_terminal_size()
os.terminal_size(columns=223, lines=18)
But running it from the Python Console window doesn't
>>>import os
>>>os.get_terminal_size()
Traceback (most recent call last):
File "<input>", line 1, in <module>
OSError: [Errno 25] Inappropriate ioctl for device
My googling hasn't produced much information specific to my issue at hand. What does OSError: [Errno 25] Inappropriate ioctl for device actually mean and how do I fix it?
Your implementation of Python relies on the terminal being compliant to the request for the terminal size by the OS. In the CPython implementation, the system call in ioctl() will fail because the device (terminal) doesn't recognize the command. You can try to set
-Drun.processes.with.pty=true
in Help/Edit Custom VM Options... as per this answer.
Instead of using os you can use shutil. This works without any hitch in Pycharm (and hopefully, by extension, IntelliJ).
import shutil
terminal_size = shutil.get_terminal_size(fallback=(120, 50))
# attributes
print('cols=', terminal_size.columns)
print('rows=', terminal_size.rows)
Import failing with following error :
C:\Users\bhush>py -3.6-64
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow__init__.py", line 34, in
from tensorflow._api.v1 import compat
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_api\v1\compat__init__.py", line 21, in
from tensorflow._api.v1.compat import v1
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_api\v1\compat\v1__init__.py", line 643, in
'tensorflow_estimator.python.estimator.api._v1.estimator'))
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\tools\component_api_helper.py", line 56, in package_hook
child_pkg = importlib.import_module(child_package_str)
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\importlib__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator__init__.py", line 8, in
from tensorflow_estimator._api.v1 import estimator
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator_api\v1\estimator__init__.py", line 8, in
from tensorflow_estimator._api.v1.estimator import experimental
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator_api\v1\estimator\experimental__init__.py", line 8, in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator\python\estimator__init__.py", line 25, in
import tensorflow_estimator.python.estimator.estimator_lib
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator\python\estimator\estimator_lib.py", line 22, in
from tensorflow_estimator.python.estimator.canned.baseline import BaselineClassifier
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator\python\estimator\canned\baseline.py", line 65, in
from tensorflow_estimator.python.estimator import estimator
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1708, in
class EstimatorV2(Estimator):
File "C:\Users\bhush\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1711, in EstimatorV2
export_savedmodel = deprecation.HIDDEN_ATTRIBUTE
AttributeError: module 'tensorflow.python.util.deprecation' has no attribute 'HIDDEN_ATTRIBUTE'
I was trying to install tensorflow nightly build. I have CUDA 10 and cuDNN 7.3.0.29. TensortFlow py -3.6–64 -m pip install tf-nightly-gpu
Then I do import tensorflow I get above stack trace. I am trying to understand possible reasons for failure.
I had the same error, then I tried doing
pip install tf-nightly-2.0-preview --ignore-installed
It solved this issue, even though I met with others. I think libraries in your environment has version clash, so this should fix your issue, as it won't reinstall installed libraries.
This link might help to find a compatible version of CUDA and Tensorflow.
Nightly build list
I had a similar error. You can try
pip install -q tensorflow==2.0.0-alpha0
Could be an issue with the nightly build on Windows. I could only get this work by reverting back to the last stable GPU build with this command
pip3 install --force-reinstall tensorflow-gpu
I'm trying to develop software using Jython and SOCKS5, so I installed PySocks, but I'm receiving the following import error:
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_31
Type "help", "copyright", "credits" or "license" for more information.
>>> import socks
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "socks.py", line 117, in <module>
TypeError: Error when calling the metaclass bases
function() argument 1 must be code, not str
How can I correctly use PySocks in Jython?
“The Jython project strives to make all Python modules run on the JVM, but there are a few differences between the implementations. Perhaps the major difference between the two implementations is that Jython does not work with C extensions. Therefore, most of the Python modules will run without changes under Jython, but if they use C extensions then they will probably not work.”
According to the jython doc, it seems jython doesn't support C entensions.
you can install this lib by this cmd:
# sudo apt-get install python-socksipy
I found the response in :
How do I install Socks / SocksIPy on Ubuntu?
I have followed all of the steps on http://steamforge.net/wiki/index.php/How_to_Install_Scrapy_in_64-bit_Windows_7 , but cannot seem to import scrapy to start working with it. I have installed basically every dependent program at least twice at this point, including pywin32. Every time I start up python and attempt to import scrapy, I get a "No module named twisted" error message.
EDIT:Robin, I am pretty sure twisted is installed correctly, but I don't know how to select which environment it uses; only the python 2.7 environment pops up as an option when I try to install twisted, but I also have anaconda installed.
I have tried importing twisted from both command line interfaces. In anaconda, it is able to find the scrapy when I import it, but cannot then find twisted.
When I attempt to open scrapy in python2.7, it just says no module named scrapy. However, when I try to import twisted it works just fine.
I think everything would be ok if I could get one or the other into the opposite folder, but I don't know how to do that.
Jean-Paul, the full path for python2.7 is C:\python27\python.exe ; the full path for anaconda is: C:\anaconda\python.exe
the import Scrapy traceback is:
C:\Anaconda>python
Python 2.7.5 |Anaconda 1.8.0 (64-bit)| (default, Jul 1 2013, 12:37:52) [MSC v.1
500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import scrapy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\scrapy-0.22.0-py2.7.egg\scrapy\__init__.py
", line 43, in <module>
from twisted import version as _txv
ImportError: No module named twisted
>>> import easy_install
>>> easy_install scrapy
File "<stdin>", line 1
easy_install scrapy
^
SyntaxError: invalid syntax
>>>
and the traceback in python2.7 is:
Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scrapy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scrapy
>>>
I hope that is enough, I would give you all of the files that were installed when twisted was, but I have no idea how to give you a list like that. Thanks for the help, and sorry for being a n00b.