Python Forum
PyInstaller not picking up selenium and urllib3 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: PyInstaller not picking up selenium and urllib3 (/thread-17860.html)



PyInstaller not picking up selenium and urllib3 - davork - Apr-26-2019

Hello World,
Smile
I am having a problem when generating exe file using PyInstaller.
This is the command that I run to generate an executable : pyinstaller.exe --onefile --icon=01.ico -- myscript.py

I have tried to add hidden-import selenium and hidden-import urllib3 but still here is an error message that I am getting:
Error:
Traceback (most recent call last): File "myscript.py", line 11, in <module> File "C:\Users\username\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\__init__.py", line 18, in <module> from .firefox.webdriver import WebDriver as Firefox # noqa File "C:\Users\username\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\firefox\webdriver.py", line 29, in <module> from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver File "C:\Users\username\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webdriver.py", line 27, in <module> from .remote_connection import RemoteConnection File "C:\Users\username\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\remote_connection.py", line 24, in <module> import urllib3 ModuleNotFoundError: No module named 'urllib3' [1616] Failed to execute script final02
btw script is working without any problems when running from VS.

Thanks


RE: PyInstaller not picking up selenium and urllib3 - SheeppOSU - Apr-27-2019

Try using the auto-py-to-exe
https://www.youtube.com/watch?v=OZSZHmWSOeM


RE: PyInstaller not picking up selenium and urllib3 - davork - May-08-2019

Nope... still not working


RE: PyInstaller not picking up selenium and urllib3 - buran - May-08-2019

(Apr-26-2019, 11:08 AM)davork Wrote: This is the command that I run to generate an executable : pyinstaller.exe --onefile --icon=01.ico -- myscript.py
After you use this command pyinstaller.exe --onefile --icon=01.ico myscript.pyyou will get a myscript.spec file.
Edit the spec file to explicitly add hidden imports
then use pyinstaller.exe --onefile --icon=01.ico myscript.spec
https://pythonhosted.org/PyInstaller/spec-files.html
by the way you may include also the icon in the spec file


RE: PyInstaller not picking up selenium and urllib3 - davork - May-09-2019

@buran when I populate this part of my spec file like this "hiddenimports=[urllib3]" and after I save it and run a pyinstaller.exe --onefile --icon=01.ico myscript.spec I get message "NameError: name 'urllib3' is not defined"


RE: PyInstaller not picking up selenium and urllib3 - buran - May-09-2019

it should be hiddenimports=['urllib3']
or you can add --hidden-import=urllib3 option on the CLI