Back

Module not found in python

  • 0
  • Self Hosted
  • Functions
Drake
9 Jun, 2023, 05:00

Maybe another __init__.py in the src folder too

TL;DR
The user is encountering a "Module not found" error in Python. They have identified that the issue is with a relative import in the snscrape package. The user tried adding the package via git in the requirements.txt file, but it resulted in build errors. The solution is to install the package using the command `pip3 install git+https://github.com/JustAnotherArchivist/snscrape.git`. There is also a suggestion to check for any additional `__init__.py` files in the src and urlGen_S4 folders which may be causing the error.
animeyeet
9 Jun, 2023, 05:03

but i already put __init__.py in src

Drake
9 Jun, 2023, 05:03

Sorry I meant the url gen folder

animeyeet
9 Jun, 2023, 05:06

locally still the same error

Drake
9 Jun, 2023, 05:07

I wonder if that space in the folder name is giving it problems 🧐

animeyeet
9 Jun, 2023, 05:09

let me try without space then

animeyeet
9 Jun, 2023, 05:14
animeyeet
9 Jun, 2023, 05:14
animeyeet
9 Jun, 2023, 05:14

now the folder name is urlGen_S4

animeyeet
9 Jun, 2023, 06:14
animeyeet
9 Jun, 2023, 06:15

i'm trying to do this way but still shows error

animeyeet
9 Jun, 2023, 06:15

this is when i did same locally (using sntwitter part)

Drake
9 Jun, 2023, 06:29

Why can't you install this using requirements.txt?

animeyeet
9 Jun, 2023, 06:30
animeyeet
9 Jun, 2023, 06:31

pip3 install git+https://github.com/JustAnotherArchivist/snscrape.git

Drake
9 Jun, 2023, 06:31

No...not with git

animeyeet
9 Jun, 2023, 06:32

currently this is dev version of the package that works

animeyeet
9 Jun, 2023, 06:33

so when put git+https://github.com/JustAnotherArchivist/snscrape.git in requirements.txt it's shows build error

Drake
9 Jun, 2023, 06:33

No, install it normally like any other pypi package

animeyeet
9 Jun, 2023, 06:40

normally i just put snscrape in requirements.txt but the current version of this package shows some error so the developer suggested to use this git+https://github.com/JustAnotherArchivist/snscrape.git

animeyeet
9 Jun, 2023, 07:31

@Steven it finally imported it

animeyeet
9 Jun, 2023, 07:31
Drake
9 Jun, 2023, 14:34

i meant to do this:

Drake
9 Jun, 2023, 14:34

output

Drake
9 Jun, 2023, 14:52

ok...i know why the relative import didn't work now. the stacktrace is:

TypeScript
Traceback (most recent call last):
  File "/usr/local/src/userlib/src/index.py", line 8, in main
    from .snscrape.modules import twitter as sntwitter
  File "/usr/local/src/userlib/src/snscrape/modules/__init__.py", line 17, in <module>
    _import_modules()
  File "/usr/local/src/userlib/src/snscrape/modules/__init__.py", line 13, in _import_modules
    module = importer.find_module(moduleName).load_module(moduleName)
  File "/usr/local/src/userlib/src/snscrape/modules/facebook.py", line 10, in <module>
    import snscrape.base

They try to find the module from the global scope, which won't show up

https://github.com/JustAnotherArchivist/snscrape/blob/c3b216c3cb8593513a018eb3ec4fd6f18d3aba5b/snscrape/modules/__init__.py#L13

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more