작성
·
344
·
수정됨
답변 2
0
TypeError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import lightgbm
2 print(lightgbm.__version__)
File ~\anaconda3\lib\site-packages\lightgbm\__init__.py:8
2 """LightGBM, Light Gradient Boosting Machine.
3
4 Contributors: https://github.com/microsoft/LightGBM/graphs/contributors.
5 """
6 from pathlib import Path
----> 8 from .basic import Booster, Dataset, Sequence, register_logger
9 from .callback import early_stopping, log_evaluation, record_evaluation, reset_parameter
10 from .engine import CVBooster, cv, train
File ~\anaconda3\lib\site-packages\lightgbm\basic.py:21
18 import numpy as np
19 import scipy.sparse
---> 21 from .compat import PANDAS_INSTALLED, concat, dt_DataTable, pd_CategoricalDtype, pd_DataFrame, pd_Series
22 from .libpath import find_lib_path
24 if TYPE_CHECKING:
File ~\anaconda3\lib\site-packages\lightgbm\compat.py:147
145 from dask.dataframe import DataFrame as dask_DataFrame
146 from dask.dataframe import Series as dask_Series
--> 147 from dask.distributed import Client, Future, default_client, wait
148 DASK_INSTALLED = True
149 except ImportError:
File ~\anaconda3\lib\site-packages\dask\distributed.py:13
5 _import_error_message = (
6 "dask.distributed is not installed.\n\n"
7 "Please either conda or pip install distributed:\n\n"
8 " conda install dask distributed # either conda install\n"
9 ' python -m pip install "dask[distributed]" --upgrade # or pip install'
10 )
12 try:
---> 13 from distributed import *
14 except ImportError as e:
15 if e.msg == "No module named 'distributed'":
File ~\anaconda3\lib\site-packages\distributed\__init__.py:23
20 from dask.config import config # type: ignore
22 from distributed._version import get_versions
---> 23 from distributed.actor import Actor, ActorFuture, BaseActorFuture
24 from distributed.client import (
25 Client,
26 CompatibleExecutor,
(...)
35 wait,
36 )
37 from distributed.core import Status, connect, rpc
File ~\anaconda3\lib\site-packages\distributed\actor.py:13
9 from typing import Generic, Literal, NoReturn, TypeVar
11 from tornado.ioloop import IOLoop
---> 13 from distributed.client import Future
14 from distributed.protocol import to_serialize
15 from distributed.utils import LateLoopEvent, iscoroutinefunction, sync, thread_state
File ~\anaconda3\lib\site-packages\distributed\client.py:117
94 from distributed.utils import (
95 CancelledError,
96 LoopRunner,
(...)
107 thread_state,
108 )
109 from distributed.utils_comm import (
110 WrappedKey,
111 gather_from_workers,
(...)
115 unpack_remotedata,
116 )
--> 117 from distributed.worker import get_client, get_worker, secede
119 logger = logging.getLogger(__name__)
121 _global_clients: weakref.WeakValueDictionary[
122 int, Client
123 ] = weakref.WeakValueDictionary()
File ~\anaconda3\lib\site-packages\distributed\worker.py:120
118 from distributed.utils_perf import disable_gc_diagnosis, enable_gc_diagnosis
119 from distributed.versions import get_versions
--> 120 from distributed.worker_memory import (
121 DeprecatedMemoryManagerAttribute,
122 DeprecatedMemoryMonitor,
123 WorkerDataParameter,
124 WorkerMemoryManager,
125 )
126 from distributed.worker_state_machine import (
127 AcquireReplicasEvent,
128 BaseWorker,
(...)
152 WorkerState,
153 )
155 if TYPE_CHECKING:
156 # FIXME import from typing (needs Python >=3.10)
File ~\anaconda3\lib\site-packages\distributed\worker_memory.py:56
53 from distributed.nanny import Nanny
54 from distributed.worker import Worker
---> 56 WorkerDataParameter: TypeAlias = Union[
57 # pre-initialized
58 MutableMapping[Key, object],
59 # constructor
60 Callable[[], MutableMapping[Key, object]],
61 # constructor, passed worker.local_directory
62 Callable[[str], MutableMapping[Key, object]],
63 # (constructor, kwargs to constructor)
64 tuple[Callable[..., MutableMapping[Key, object]], dict[str, Any]],
65 # initialize internally
66 None,
67 ]
69 worker_logger = logging.getLogger("distributed.worker.memory")
70 worker_logger.addFilter(RateLimiterFilter(r"Unmanaged memory use is high"))
File ~\anaconda3\lib\typing.py:243, in _tp_cache.<locals>.inner(*args, **kwds)
241 except TypeError:
242 pass # All real errors (not unhashable args) are raised below.
--> 243 return func(*args, **kwds)
File ~\anaconda3\lib\typing.py:316, in _SpecialForm.__getitem__(self, parameters)
314 @_tp_cache
315 def __getitem__(self, parameters):
--> 316 return self._getitem(self, parameters)
File ~\anaconda3\lib\typing.py:421, in Union(self, parameters)
419 msg = "Union[arg, ...]: each arg must be a type."
420 parameters = tuple(_type_check(p, msg) for p in parameters)
--> 421 parameters = _remove_dups_flatten(parameters)
422 if len(parameters) == 1:
423 return parameters[0]
File ~\anaconda3\lib\typing.py:215, in _remove_dups_flatten(parameters)
213 params.append(p)
214 # Weed out strict duplicates, preserving the first of each occurrence.
--> 215 all_params = set(params)
216 if len(all_params) < len(params):
217 new_params = []
TypeError: unhashable type: 'list'
넵! 이렇게 에러가 떴네용
아 제가 그냥 다시 아나콘다를 지워버리고 해도 안되길래..new_base 가상환경을 다시 만들어서 처음부터 설치를 진행중입니다. 파이썬도 3.9 버전으로 맞추고 다른 것도 다 설치가 순조롭게 진행되는 와중에
(new_base) C:\Windows\System32>pip install lightbgm==3.3.2
ERROR: Could not find a version that satisfies the requirement lightbgm==3.3.2 (from versions: none)
ERROR: No matching distribution found for lightbgm==3.3.2
이처럼 lightbgm을 깔려고 하니 저런 에러가 뜨네요..ㅜㅜ
3.3.3 으로 하니깐 잘 깔렸습니다!!
하지만 이후에 new_base 가상환경 상에서 주피터 노트북을 깔고 실행하여 lightbgm을 다시 실행시켰더니
이러한 오류가 뜨는군요ㅠㅠㅠ
jupyter notebook은 new_base 가상환경에서 실행이 되지 않아서 lightgbm을 import하지 못한것 같습니다.
new_base 가상환경에서
pip install ipykernel
설치 후
python -m ipykernel install --user --name=new_base
수행 하신 다음에
기존 주피터 노트북 종료하시고, 윈도우즈의 메뉴에서 새롭게 Jupyter Notebook을 기동해 보십시요.
그런 다음에 browser로 접속해서, New를 선택하시고, 여기서 Python3 를 선택하지 마시고, new_base 가상환경을 선택해 주십시요.
이렇게 열린 노트북 커널에서 lightgbm을 import 해보십시요.
0
conda 환경이 새로운 환경이 아닌가요?
지금 Dask 가 설치되어 있는것 같습니다만, 오류가 Dask관련해서 발생하는 것 같습니다.
이미 가지고 계시는 가상환경에 lightgbm을 설치하신 건가요? 아님 강의대로 새로운 conda 환경에 lightgbm을 설치하신 건가요?