Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

ImportError: cannot import name 'define' from 'attr' #62

Open
QGB opened this issue Jun 20, 2023 · 1 comment
Open

ImportError: cannot import name 'define' from 'attr' #62

QGB opened this issue Jun 20, 2023 · 1 comment

Comments

@QGB
Copy link

QGB commented Jun 20, 2023

In [221]: from coinmarketcap import Market
     ...: cmc=coinmarketcap = Market()
     ...: coinmarketcap.listings()
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-221-fa9a3c90ed80> in <module>
----> 1 from coinmarketcap import Market
      2 cmc=coinmarketcap = Market()
      3 coinmarketcap.listings()

C:\QGB\Anaconda3\lib\site-packages\coinmarketcap\__init__.py in <module>
      8 __license__ = 'Apache v2.0 License'
      9
---> 10 from .core import Market

C:\QGB\Anaconda3\lib\site-packages\coinmarketcap\core.py in <module>
      7 import requests
      8 import tempfile
----> 9 import requests_cache
     10
     11 class Market(object):

C:\QGB\Anaconda3\lib\site-packages\requests_cache\__init__.py in <module>
      5 __version__ = '1.0.1'
      6
----> 7 from .backends import *
      8 from .cache_keys import *
      9 from .models import *

C:\QGB\Anaconda3\lib\site-packages\requests_cache\backends\__init__.py in <module>
      5
      6 from .._utils import get_placeholder_class, get_valid_kwargs
----> 7 from .base import BaseCache, BaseStorage, DictStorage
      8
      9 # Backend-specific keyword arguments equivalent to 'cache_name'

C:\QGB\Anaconda3\lib\site-packages\requests_cache\backends\base.py in <module>
     18
     19 from ..cache_keys import create_key, redact_response
---> 20 from ..models import AnyRequest, CachedResponse
     21 from ..policy import DEFAULT_CACHE_NAME, CacheSettings, ExpirationTime
     22 from ..serializers import SerializerType, init_serializer

C:\QGB\Anaconda3\lib\site-packages\requests_cache\models\__init__.py in <module>
      6
      7 from .base import RichMixin
----> 8 from .raw_response import CachedHTTPResponse
      9 from .request import CachedRequest
     10 from .response import CachedResponse, DecodedContent, OriginalResponse

C:\QGB\Anaconda3\lib\site-packages\requests_cache\models\raw_response.py in <module>
      3 from typing import TYPE_CHECKING, Optional
      4
----> 5 from attr import define, field, fields_dict
      6 from requests import Response
      7 from urllib3.response import (  # type: ignore  # import location false positive

ImportError: cannot import name 'define' from 'attr' (C:\QGB\Anaconda3\lib\site-packages\attr\__init__.py)

@YmClash
Copy link

YmClash commented Jul 16, 2023

i got the error : Traceback (most recent call last):
File "C:\Users\y_mc\PycharmProjects\Mogwai_Wallet\venv\lib\site-packages\requests_cache\backends_init_.py", line 50, in create_backend
return registry[backend_name](cache_name, **options)
KeyError: 'sqlite'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.3\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "", line 1, in
File "C:\Users\y_mc\PycharmProjects\Mogwai_Wallet\venv\lib\site-packages\coinmarketcap\core.py", line 56, in listings
response = self.__request('listings/', params=None)
File "C:\Users\y_mc\PycharmProjects\Mogwai_Wallet\venv\lib\site-packages\coinmarketcap\core.py", line 34, in __request
response_object = self.session.get(self.base_url + endpoint, params = params, timeout = self.request_timeout)
File "C:\Users\y_mc\PycharmProjects\Mogwai_Wallet\venv\lib\site-packages\coinmarketcap\core.py", line 27, in session
self.session = requests_cache.CachedSession(cache_name=self.cache_name, backend='sqlite', expire_after=120)
File "C:\Users\y_mc\PycharmProjects\Mogwai_Wallet\venv\lib\site-packages\requests_cache\core.py", line 68, in init
self.cache = backends.create_backend(backend, cache_name, backend_options)
File "C:\Users\y_mc\PycharmProjects\Mogwai_Wallet\venv\lib\site-packages\requests_cache\backends_init
.py", line 53, in create_backend
raise ImportError('You must install the python package: %s' %
ImportError: You must install the python package: sqlite3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants