-1

I can't run script because of this problem

It's frequent problem for me, but now i don't know what to do.

(base) C:\Users\Mimek\Desktop\instagram-followers-scraper-master>python main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    from modules import compare
ImportError: cannot import name 'compare' from 'modules' (C:\Users\Mimek\Anaconda3\lib\site-packages\modules.py)

but

(base) C:\Users\Mimek\Desktop\instagram-followers-scraper-master>pip install modules
Requirement already satisfied: modules in c:\users\mimek\anaconda3\lib\site-packages (1.0.0)

(base) C:\Users\Mimek\Desktop\instagram-followers-scraper-master>pip install compare
Requirement already satisfied: compare in c:\users\mimek\anaconda3\lib\site-packages (0.2b0)

I already installed these modules.

Please help me guys I cant stand it anymore -_-

ForceBru
  • 43,482
  • 10
  • 63
  • 98
Yoshow2137
  • 31
  • 5
  • But... according to `pip`, `modules` and `compare` are different modules. Why are you trying to import one from the other? – ForceBru Apr 05 '20 at 10:59
  • `from datetime import datetime from modules import compare from modules import file_io from modules import stats from modules.scraper import Scraper from modules.utils import ask_input, ask_multiple_option` – Yoshow2137 Apr 05 '20 at 11:36
  • It's not my code, i got it from github, just needed instagram scraper – Yoshow2137 Apr 05 '20 at 11:37
  • 1
    [This one](https://github.com/tonoli/instagram-followers-scraper)? If so, have you followed the instructions in the README? – ForceBru Apr 05 '20 at 11:39
  • Exactly, i did everything – Yoshow2137 Apr 05 '20 at 11:45
  • 1
    Why did you do `pip install modules` and `pip install compare`, then? The README doesn't say anything about that. In fact, `modules` is a directory that's already provided by the repo, along with `modules.compare`, `modules.stats` and the like. You should uninstall `modules` and `compare` that you installed via `pip` - they have nothing to do with this project. – ForceBru Apr 05 '20 at 11:48
  • You're completely right, i just deleted modules.py from site-packages and everything is working. Thanks – Yoshow2137 Apr 05 '20 at 11:52
  • Ugh, i got another error, `selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home` – Yoshow2137 Apr 05 '20 at 12:19
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/210990/discussion-between-yoshow2137-and-forcebru). – Yoshow2137 Apr 05 '20 at 12:19

1 Answers1

0

Trying adding first an import modules command. I think you have a dependency circle as explained here.

Running a script as a module requires some carefulness in the way you handle dependencies.

linog
  • 5,786
  • 3
  • 14
  • 28