Selenium import error when running test case with RobotFramework - selenium

I'm getting the below error when I'm trying to run a test case in RobotFramework. I installed Selenium2Library but it looks like RF can't find it. Everything works fine with SeleniumLibrary.
Selenium2Library is installed in C:\Python27\lib\site-packages. I uninstalled and installed it a few times to make sure the installation is correct. There were no errors during the installations.
Any ideas where to look for the problem?
Here is the error:
c:\testing>pybot testone.txt
[ ERROR ] Error in file 'c:\testing\testone.txt' in table 'Settings': Importing test library 'Selenium2Library' failed: ImportError: No module named selenium
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
from keywords import *
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\__init__.py", line 3, in <module>
from _browsermanagement import _BrowserManagementKeywords
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 4, in <module>
from selenium import webdriver
PYTHONPATH:
C:\Python27\lib\site-packages\robot\libraries
C:\Python27\lib\site-packages
C:\Windows\system32\python27.zip
C:\Python27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages\wx-2.8-msw-unicode

Resolved the problem by removing Selenium2Library folder and reinstalling it with pip command (which installs all necessary packages).
pip install robotframework-selenium2library

I also had a similar problem. I'm running both Python 3.7 and 3.8 because RIDE does not work with 3.8.
I had installed robot framework for Python 3.8 before, and after that I installed everything on 3.7. The problem was fixed when I uninstalled robot framework (and every package related to it) from 3.8 and installed every package on Python 3.7 only.

Related

Run Python, Anaconda, Pandas, Numpy offline on a Server getting dependency error

After installing Anaconda on a Virtual Machine I run a script which is working on my local machine but not on my Virtual Machine.
I'm getting the error Message:
C:\Users\...\python>"C:\ProgramData\Anaconda3\python.exe" "C:\Users\...\reporting.py"
C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\...\reporting.py", line 1, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.18.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
The VM has no Internet. Is there any way to install all the required libs and frameworks?
You can package your script and used libraries using something like Pyinstaller. When you use an virtualenv keep in mind that all the packages that you use during pyinstaller execution are stored and may lead to an huge .exe

Spacy language model installation in python returns ImportError (ImportError: DLL load failed: The specified module could not be found.)

Traceback (most recent call last):
File "c:\users\sathish.pv\appdata\local\continuum\anaconda3\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "c:\users\sathish.pv\appdata\local\continuum\anaconda3\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "c:\users\sathish.pv\appdata\local\continuum\anaconda3\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\sathish.pv\Envs\env\lib\site-packages\spacy\__init__.py", line 12, in <module>
from . import pipeline
File "C:\Users\sathish.pv\Envs\env\lib\site-packages\spacy\pipeline\__init__.py", line 4, in <module>
from .pipes import Tagger, DependencyParser, EntityRecognizer, EntityLinker
File "pipes.pyx", line 1, in init spacy.pipeline.pipes
ImportError: DLL load failed: The specified module could not be found.
I have tried reinstalling spaCy package using "pip install spacy" but still end up getting the same error. How do I deal with this? I am using python version 3.7.4, Windows 10
I tried using the following spacy installation methods. But get the same error
ImportError: DLL load failed: The specified module could not be found.
pip install spacy
pip install -U spacy
python -m spacy validate
In my case it was resolved by installing Visual C++ Redistributable for Visual Studio 2015.
You can download it from here: https://www.microsoft.com/en-in/download/details.aspx?id=48145.
(This would actually be better off in a comment to Kumar Rajwani's answer, but I don't have enough reputation for comments yet)
For me it also got fixed by installing a (different) version of Visual C++ Redistributable for Visual Studio 2015.
But: Apparently, it is important to distinguish which build version of Visual C++ Redistributable for Visual Studio 2015 to install. And if you already have a newer version on your computer than the one linked in Kumar Rajwani's answer, you cannot install the older version without temporarily uninstalling the newer version. And you should definitely reinstall it, because a redistributable package comes with a specific application that needs it for its work. What works best for me so far: Download and install all versions in one package. https://www.techpowerup.com/download/visual-c-redistributable-runtime-package-all-in-one/

Anaconda install of Tensorflow missing 'audio_ops' from contrib framework

I'm trying to follow along the Audio Recognition Network tutorial.
I've created an Anaconda environment with python 3.6 and followed the install instruction accordingly for installing the GPU whl.
I can run the 'hello world' TF example.
When I go to run 'train.py' in the Audio Recognition Network tutorial/example, I get:
Traceback (most recent call last):
File "train.py", line 79, in <module>
import input_data
File "/home/philglau/speech_commands/input_data.py", line 35, in <module>
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
ImportError: cannot import name 'audio_ops'
The code in the tutorial that fails is:
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
I then backed up that chain until I could import some part of it:
import tensorflow.contrib.framework as test ==> works
import tensorflow.contrib.framework.python as test --> fail:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.contrib.framework' has no attribute 'python'
Not sure where I'm going wrong on my install.
Details:
Ubuntu 16.04
Anaconda env with python 3.6
Followed the 'anaconda' instruction on the TF install page. (GPU version)
I also tried using a python 2.7 env for anaconda but got the same results.
It looks like they're releasing the audio_ops modules in version 1.4 (https://github.com/tensorflow/tensorflow/issues/11339#issuecomment-327879009).
Until v1.4 is released, an easy way around this is to install the nightly tensorflow build
pip install tf-nightly
or with the docker image linked in the issue comment.
The short answer:
The framework is missing the "audio_ops.py" and the example wont work until the file is released. Or you code the wrappers.
More on this:
If you go to the: tensorflow.contrib.framework.python.ops local folder you can find other *_ops.py files but not the "audio_ops.py".
If you get it from the Master at: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/framework/python/ops
You will find the file is almost empty and with import labels wrong: "audio_ops" vs "gen_audio_ops".
With almost empty I mean that: decode_wav, encode_wav, audio_spectrogram , mfcc are not implemented/wrapped.
So, no working example and no fun.
We need to check again when "audio_ops.py" is released.
Here:
https://github.com/tensorflow/tensorflow/issues/11339
You can find a Developer saying: "we don't actually want to make them public / supported yet. I'm sorry this decision wasn't better documented"

unittest in tensorflow, python session_test.py, got a exception

I'm trying to run session_test.py from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/client/session_test.py, So in my anaconda, tensorflow virtual env, I went to the corresponding directory in tensorflow like ../master/tensorflow/python/client/.. and run
python session_test.py
I got exception info like this:
Traceback (most recent call last):
File "session_test.py", line 32, in
from tensorflow.core.protobuf import cluster_pb2
ImportError: cannot import name 'cluster_pb2'
What package I should install or related documents that I could read about it. Is there anyone trying to do the same thing, run those unit test coming along with each module in tensorflow repo?
Please help me, thanks!
That line was added just a couple of weeks ago (see commit), and relates to a new feature being implemented in TensorFlow. Unless you have compiled and installed a very bleeding-edge version of TensorFlow you won't be able to run it. Instead, try to run the script corresponding to the version of TensorFlow that you have installed (for example, this is for version 1.1.0, the latest stable release at the time of writing).

Adding beautifulsoup in pycharm

How to install beautifulsoup4 in pycharm:
Click on settings, now look for the project interpreter. This is where you can add beautifulsoup by clicking on the green cross on the right side of the screen.
I did this in pycharm, but there occurs error in installation. The error message is:
Traceback (most recent call last):
File "C:/Users/Rishi/PycharmProjects/untitled2/beautifuls.py", line 3, in
from bs4 import BeautifulSoup
File "C:\Python34\lib\site-packages\bs4_init_.py", line 175
except Exception, e:
^
SyntaxError: invalid syntax
Process finished with exit code 1
python.org/pypi
This is the repositories set in the available packages list.
Do you have a version of Python 2 on the same machine as your Python 3.4 interpreter?
If so you may want to check to make sure that you are using the correct version of pip. I would suggest removing beautiful soup and re-adding it manually as a test.
pip3 install BeautifulSoup4
You also need to find "beautifulsoup4" (for python 3.x)