cromewar / DAO-Full-Stack

A full Stack DAO using the standards of the industry and building a fully functional frontend.
16 stars 23 forks source link

ModuleNotFoundError: No module named 'moralis' #1

Closed 13x54n closed 3 months ago

13x54n commented 3 months ago

Issue Recreation

The following issue was raised while I was trying to setup the DAO-Full-Stack on my local device. I tried bumping into different python versions but faced the same issue unsolved. Currently, I run python3 as per the installation guide suggested.

python3 -m venv venv
source venv/bin/activate

Output: image

Requirements.txt: General documentation consists few but it was auto-generated by compiler during module installation.

django
djangorestframework
django-cors-headers
eth-brownie==1.20.6
web3
moralis==0.0.1
typing-extensions==4.9.0
urllib3==2.2.1
wheel==0.42.0

Server:

python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/core/management/commands/runserver.py", line 133, in inner_run
    self.check(display_num_errors=True)
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/core/management/base.py", line 486, in check
    all_issues = checks.run_checks(
                 ^^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
           ^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 519, in check
    for pattern in self.url_patterns:
                   ^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 738, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
                       ^^^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 731, in urlconf_module
    return import_module(self.urlconf_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/backend/urls.py", line 18, in <module>
    from tokens import views
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/tokens/views.py", line 3, in <module>
    from .services import get_token_balance, authenticate_challenge, verify_challenge
  File "/home/notsolexy/Documents/DAO-Full-Stack/backend/tokens/services.py", line 1, in <module>
    from moralis import evm_api, auth
ModuleNotFoundError: No module named 'moralis'
13x54n commented 3 months ago

To resolve the dependency conflicts, let's first remove the specific version constraints where possible and let pip handle the dependency resolution. Here is an updated requirements.txt that tries to minimize version constraints:

plaintext
Copy code
django
djangorestframework
django-cors-headers
eth-brownie
web3
moralis

We'll start by uninstalling all existing packages and then installing from the updated requirements.txt.

  1. Clear the Virtual Environment Deactivate the virtual environment if it is active:

    deactivate
    rm -rf venv
  2. Create a New Virtual Environment Create a new virtual environment:

    python3.12 -m venv venv
    source venv/bin/activate
    pip install --upgrade pip
  3. Install Dependencies Install dependencies from the requirements.txt:

    pip install -r requirements.txt
  4. Verify Installation and Resolve Conflicts Manually If there are still conflicts, install dependencies individually to pinpoint the issue and resolve it:

Install django and Related Packages

pip install django djangorestframework django-cors-headers
Install eth-brownie with Specific Dependencies
pip install eth-brownie==1.20.6 typing-extensions==4.9.0 urllib3==2.2.1

Install web3 and moralis

pip install web3 moralis
  1. Verify the Installation of All Packages Check the list of installed packages to ensure there are no conflicts:
    pip list
  2. Run Your Django Server After ensuring that all dependencies are installed correctly, try running your Django server again:
    python manage.py runserver