Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InstaPy: "Error, unable to determine correct filename for 64bit linux"

Anyone knows how to solve of fix this issue? Stack trace from console, that reports an error after execution:

    InstaPy Version: 0.6.9
    ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
    Workspace in use: "/home/zanettra/InstaPy"
    Error, unable to determine correct filename for 64bit linux
    Traceback (most recent call last):
    File "unfollow.py", line 24, in <module>
    headless_browser=False)
    File "/usr/local/lib/python3.6/dist-packages/instapy/instapy.py", line 
    322, in __init__
    self.logger,
      File "/usr/local/lib/python3.6/dist-packages/instapy/browser.py", line 114, in set_selenium_local_session
        driver_path = geckodriver_path or get_geckodriver()
      File "/usr/local/lib/python3.6/dist-packages/instapy/browser.py", line 36, in get_geckodriver
        sym_path = gdd.download_and_install()[1]
      File "/usr/local/lib/python3.6/dist-packages/webdriverdownloader/webdriverdownloader.py", line 177, in download_and_install
        show_progress_bar=show_progress_bar)
      File "/usr/local/lib/python3.6/dist-packages/webdriverdownloader/webdriverdownloader.py", line 129, in download
        download_url = self.get_download_url(version, os_name=os_name, bitness=bitness)
      File "/usr/local/lib/python3.6/dist-packages/webdriverdownloader/webdriverdownloader.py", line 324, in get_download_url
        raise RuntimeError(info_message)
    RuntimeError: Error, unable to determine correct filename for 64bit linux
like image 412
Robert Zanetti Avatar asked Aug 03 '20 19:08

Robert Zanetti


2 Answers

Adding what worked for me on Macos.

Simplest thing to do on is download the drivers from official latest github link and extract the zip folder.

Create a virtualenv and in the bin folder for the virtualenv add the geckodriver executable.

You can also manually add the path of the geckodriver using sys.path as below:

import sys
sys.path.insert(0,'/Users/myfolder/Downloads/geckodriver')

But this wasn't working for me for some reason. Virtualenv solution works fine.

like image 181
Vaulstein Avatar answered Oct 12 '22 21:10

Vaulstein


This problem is not related to InstaPy but the webdriverdownloader.py from webdriverdownloader. For Ubuntu you can fix the problem with sudo apt install firefox-geckodriver; Other OS will have similar solution to install the geckodirver.


For macOS users, the problem is due to the new arch ARM in macOS geckodriver-v0.30.0-macos.tar.gz and geckodriver-v0.30.0-macos-aarch64.tar.gz

Available versions Nov 2021:

['geckodriver-v0.30.0-linux32.tar.gz', 'geckodriver-v0.30.0-linux32.tar.gz.asc', 'geckodriver-v0.30.0-linux64.tar.gz', 'geckodriver-v0.30.0-linux64.tar.gz.asc', 'geckodriver-v0.30
.0-macos-aarch64.tar.gz', 'geckodriver-v0.30.0-macos.tar.gz', 'geckodriver-v0.30.0-win32.zip', 'geckodriver-v0.30.0-win64.zip']

You can patch the file for GeckoDriverDownloader -> site-packages/webdriverdownloader/webdriverdownloader.py with the following:

   1   │ diff --git a/Users/user/GitHub/InstaPy/venv39/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py b/Users/user/GitHub/InstaPy/venv39/lib/python3.9/
       │ site-packages/webdriverdownloader/webdriverdownloader_patch.py
   2   │ index bc01c2d..057862a 100644
   3   │ --- a/Users/user/GitHub/InstaPy/venv39/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py
   4   │ +++ b/Users/user/GitHub/InstaPy/venv39/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader_patch.py
   5   │ @@ -382,6 +382,13 @@ class GeckoDriverDownloader(WebDriverDownloaderBase):
   6   │              )
   7   │              logger.error(info_message)
   8   │              raise RuntimeError(info_message)
   9   │ +        # macos is only available for 64bit, 32bit is deprectated
  10   │ +        # geckodriver is available for x64 and aarch64, this is why the "RuntimeError: Error, unable to determine correct filename for 64bit macos"
  11   │ +        # geckodriver-v0.30.0-macos.tar.gz
  12   │ +        # geckodriver-v0.30.0-macos-aarch64.tar.gz
  13   │ +        if os_name == "macos":
  14   │ +            bitness = ".tar.gz"  # no bitness for macos since it is 64bit only. Use the extension for tar.gz
  15   │ +
  16   │          if len(filename) > 1:
  17   │              filename = [name for name in filenames if os_name + bitness in name]
  18   │              if len(filename) != 1:
like image 22
elulcao Avatar answered Oct 12 '22 19:10

elulcao