paladini / aax2mp3-easy

Convert Audible AAX (.aax) files to MP3 (.mp3) with no effort.
MIT License
72 stars 19 forks source link

On running script >> ModuleNotFoundError: No module named 'selenium' #4

Open Caruso33 opened 6 years ago

Caruso33 commented 6 years ago

Output of Bash:

Installing collected packages: selenium
Successfully installed selenium-3.8.0
Traceback (most recent call last):
  File "audible-activator-feature_login_as_arg/audible-activator.py", line 8, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'

Any suggestions why the import from selenium no longer works?

paladini commented 6 years ago

I'll try to check that for you as soon as possible, but can you describe what's your environment?

Caruso33 commented 6 years ago

I've just set up a new Ubuntu 17.10 environment. The error remains.

Trophonix commented 6 years ago

Same issue here on Manjaro (Arch based)

dagmarkrefting commented 6 years ago

I had also some issues with the installation (Ubuntu 16.04), getting the same error, however due to another issue;

sudo: pip: command not found
sudo: pip: command not found
Traceback (most recent call last):
  File "audible-activator-feature_login_as_arg/audible-activator.py", line 8, in <module>
    from selenium import webdriver
ImportError: No module named selenium

This could be solved by installation of python-setuptools and python easy_install pip. But I also had to reinstall aax2mp3-easy to make in work properly. So if selenium and chromium runs otherwise for you, a reinstall of the tool may help.

paladini commented 6 years ago

Hey guys, try to install Selenium running one of the following commands:

pip install selenium

or

sudo pip install selenium

Can you tell me the output for AAX2MP3-easy after running one of these commands?

nikoroxy commented 6 years ago

audible-activator.py works well, it stops to work when runned from aax2mp3

EDIT: ./aax2mp3_easy.sh <user> <pass> <file> first run output tail is:

Requirement already satisfied: requests in /usr/local/lib/python2.7/dist-packages 
Requirement already satisfied: selenium in /usr/local/lib/python2.7/dist-packages
Traceback (most recent call last):
  File "audible-activator-feature_login_as_arg/audible-activator.py", line 8, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium' 

sudo ./aax2mp3_easy.sh <user> <pass> <file> first run output tail is:

Requirement already satisfied: requests in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: selenium in /usr/local/lib/python2.7/dist-packages
Traceback (most recent call last):
File "audible-activator-feature_login_as_arg/audible-activator.py", line 148, in
fetch_activation_bytes(username, password, options)
File "audible-activator-feature_login_as_arg/audible-activator.py", line 57, in fetch_activation_bytes
executable_path=chromedriver_path)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 75, in init
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 154, in init
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.9.0-6-amd64 x86_64)

2018-03-03 02:19:06+0100 Decoding Player with auth code [*]...

Obviously no updates on both attempts

Trophonix commented 6 years ago

I attempted to use this on my Macbook and got the same result as @nikoroxy

birawaich commented 6 years ago

So I had the same issue as you guys. (Ubuntu 16.04 LTS)

As @dagmarkrefting suggested I installed python-setuptools and python easy_install pip. After that I could install, as @paladini wrote, Selenium. This still gave the the error:

Traceback (most recent call last):
  File "audible-activator-feature_login_as_arg/audible-activator.py", line 148, in <module>
    fetch_activation_bytes(username, password, options)
  File "audible-activator-feature_login_as_arg/audible-activator.py", line 57, in fetch_activation_bytes
    executable_path=chromedriver_path)
  File "/home/USERNAME/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/USERNAME/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/USERNAME/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/USERNAME/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/home/USERNAME/.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-119-generic x86_64)

After that I tried it step by step with audible-activator.py and AAXtoMP3 (which were automatically installed) according to code.opoki.com/.... Got a similar error in the first step. Then I realized that it was simply looking for Chrome.

[Solution] I installed Chrome and it worked.

Not only did it work in the manual 2 step variant but also this scripted worked :) I hope this will solve your problems too. Maye just adding a part where it checks if Chrome is installed?

Thank you for this awesome script :D

hexdream commented 6 years ago

Hi Guys,

You need to specify the version of pip as it is wanting to install python3 version by default:

pip2 install selenium

or in my case to avoid error messages running sudo:

sudo -H pip2 install selenium

I believe this will resolve the issue.

cargocultprogramming commented 6 years ago

@hexdream 's solution worked for me.

However, the script exits after opening chrome with ERROR Missing authcode.

Sunildevbasavatti commented 6 years ago

from selenium import webdriver ModuleNotFoundError: No module named 'selenium'

I am getting the above error, I have installed pip install -U selenium. Any suggestions to get this resolved

imansh77 commented 6 years ago

from selenium import webdriver ModuleNotFoundError: No module named 'selenium'

I am getting the above error, I have installed pip install -U selenium. Any suggestions to get this resolved

i have same issue! i have installed selenium via pip3 and checked it but i still get this error dont know why

write4alive commented 5 years ago

from selenium import webdriver ModuleNotFoundError: No module named 'selenium' I am getting the above error, I have installed pip install -U selenium. Any suggestions to get this resolved

i have same issue! i have installed selenium via pip3 and checked it but i still get this error dont know why

got same problem on my head !

paladini commented 5 years ago

Hey guys, just to tell you that I'm going to check with the developer from Selenium about that issue. Seems to be something related to the lib.

shyamkumar0707 commented 5 years ago

I use MAC and I have selenium working fine with python 3.7 from pycharm, but when I run the same python code from local Jenkins / slack (bot/snippet run) it gives me the same error as you guys are discussing, some help here is appreciated please, thank you.

"Import Error : No module named selenium"

iBocchese commented 5 years ago

Hi Guys,

little premise: unfortunately for me, I am not a CS student. But I am learning on my own and luckily Github and Stackflow communities are very helpful. Thus, I would like to say that I have already tried almost all the online suggestions I have found to solve previusly my issue (such as easy_install / sudo pip install / pip install...)

yet, this error message is still shown:

Isabellas-Air:instagram-profilecrawl isabellabocchese$ python3.6 crawl_profile.py ibocchese Traceback (most recent call last): File "crawl_profile.py", line 5, in from util.datasaver import Datasaver File "/Users/isabellabocchese/instagram-profilecrawl/util/datasaver.py", line 5, in from .util import check_folder File "/Users/isabellabocchese/instagram-profilecrawl/util/util.py", line 1, in from selenium.common.exceptions import NoSuchElementException ModuleNotFoundError: No module named 'selenium' Isabellas-Air:instagram-profilecrawl isabellabocchese$

AND

Isabellas-Air:instagram-profilecrawl isabellabocchese$ pip install exceptions selenium Collecting exceptions Could not find a version that satisfies the requirement exceptions (from versions: ) No matching distribution found for exceptions Isabellas-Air:instagram-profilecrawl isabellabocchese$ easy_install exceptions selenium Searching for exceptions Reading https://pypi.python.org/simple/exceptions/ Download error on https://pypi.python.org/simple/exceptions/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) -- Some packages may not be found! Couldn't find index page for 'exceptions' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading https://pypi.python.org/simple/ Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) -- Some packages may not be found! No local packages or working download links found for exceptions error: Could not find suitable distribution for Requirement.parse('exceptions')

Any suggestions ? ;) thank you !!

vivienzou1 commented 5 years ago

same here on mac, python 3.7 selenium 3.141.0 I can run at the very first time after successfully install selenium, but fail on it a day after with error " from selenium import webdriver ImportError: No module named selenium" any idea? many thanks

Ilya88Weber commented 5 years ago

" from selenium import webdriver ImportError: No module named selenium" Same issue :(

esalkan commented 5 years ago

Traceback (most recent call last): File "quickstart.py", line 3, in from instapy import InstaPy File "/home/alkalin/Desktop/InstaPy/instapy/init.py", line 3, in from .instapy import InstaPy File "/home/alkalin/Desktop/InstaPy/instapy/instapy.py", line 12, in from selenium import webdriver ModuleNotFoundError: No module named 'selenium'

i already installed selenium and pip and pip2 and pip3 but nothing can be imported.

timo-x30xe commented 5 years ago

I got the same problem. im new to programming and i read a lot about that error now and ive done everything i could. It says its already installed but it wont let me import webdrivers from slenium. C:\Users\timok\PycharmProjects\FirstSeleniumTest>pip install selenium Requirement already satisfied: selenium in c:\users\timok\appdata\local\programs\python\python37-32\lib\site-packages (3.141.0) Requirement already satisfied: urllib3 in c:\users\timok\appdata\local\programs\python\python37-32\lib\site-packages (from selenium) (1.24.1)

Hope i get help here

superpigsam commented 5 years ago

Same problem, but on VS code. Solution found here: https://askubuntu.com/questions/1130323/importerror-no-module-named-selenium?rq=1

Open a command prompt and type "python3". When you get the python prompt, type "import Selenium" and see what error (if any) you get. It sounds like VS is running a separate python environment.

Seems we need to check the version if the python interpreter selected is of the same environment as the python with selenium installed.

wenyiyan commented 5 years ago

Please try specify the python directory:

The code works for me (Execute shell) command: /Users/Username/anaconda2/bin/python text.py

(My environment: Jenkins in local mac, py code in local )

pfabreu commented 5 years ago

Using python2 worked for me, install pip2 (i.e sudo apt install python-pip), then pip2 install selenium and pip2 install requests (you need this one too). Also, install chrome lol.

tanel3203 commented 5 years ago

Heh, the above, @pedro-abreu -s actually worked. did pip install selenium on py2, still ImportError. Using pip2 explicitly fixed it.

eduamf commented 5 years ago

I solved it going to "base" environment and installing selenium there too (I was trying to uso on "pytorch1" environment): conda activate base conda install -c conda-forge selenium

After turn back to "pytorch1", ... conda activate pytorch1

Every thing ok. Don't ask me why. :-)

parisimaa commented 4 years ago

well... this is crazy I have the same issue with selenium package a few days ago it worked properly (I don't know how) but I was running the program today and the error comes up again and I tried several things but still have a problem

gitwiserabbit commented 4 years ago

To fix this problem - you need (Example is for windows, do the same for your system accordingly): 1) Go to the subdirectory \Lib\site-packages\ of the installed Python environment directory (for example, if Python was installed on the C: drive in the Python directory, then go to c:\Python\Lib\site-packages) 2) Find the [selenium] catalog in it. If there is no [selenium] but exists, for example, [selenium-3.141.0.dist-info], you need to delete all directories containing "selenium" 3) Run the console (Win + R-> cmd.exe-> Enter) Run the selenium installation command again: pip install selenium 4) Make sure the [selenium] directory appears in \Lib\site-packages\

paulolamorea commented 4 years ago

Helllllllpppppppppppppppp

File "C:\Users\Windows\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 38 str = basestring ^ IndentationError: unexpected indent

Someone help me?

fcazalladev commented 2 months ago

Hello everyone!

1.- Be sure selenium is installed 2.- Add a step inside your script to print the Python route: "which Python" or "which Python3" 3.- See the which command returned in the jenkins console. 4.- Check if this is the path you expect. If not, you can specify the full path to Python in your script. (The path returned from "which" command) i.e.: "/Users/your-username/.pyenv/shims/python3 pythonfile.py"

Hope it is useful!