AREPL-vscode
AREPL-vscode copied to clipboard
Possible error with repeated use of sklearn.
When I try to evaluate for the second time, or some modification of the code, I get the following error. And this does not disappear until I start a new instance of AREPL.
from sklearn import datasets
iris= datasets.load_iris()
import pandas as pd
iris_df= pd.DataFrame(iris.data)
iris_df.columns=iris.feature_names
print(iris.target)
Expected behavior shown in the animated gif below
Screenshots shown in the animated gif below
Other Information (please complete the following information):
- OS: [Windows10]
- Python Version [3.9.4]
Additional context
Traceback (most recent call last):
line 1, in <module>
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\sklearn\__init__.py", line 82, in <module>
from .base import clone
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\sklearn\base.py", line 17, in <module>
from .utils import _IS_32BIT
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\sklearn\utils\__init__.py", line 23, in <module>
from .class_weight import compute_class_weight, compute_sample_weight
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\sklearn\utils\class_weight.py", line 7, in <module>
from .validation import _deprecate_positional_args
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\sklearn\utils\validation.py", line 26, in <module>
from .fixes import _object_dtype_isnan, parse_version
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\sklearn\utils\fixes.py", line 28, in <module>
from pkg_resources import parse_version # type: ignore
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\pkg_resources\__init__.py", line 74, in <module>
from pkg_resources.extern import appdirs
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 565, in module_from_spec
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\pkg_resources\extern\__init__.py", line 52, in create_module
return self.load_module(spec.name)
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\pkg_resources\extern\__init__.py", line 37, in load_module
__import__(extant)
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\pkg_resources\_vendor\appdirs.py", line 560, in <module>
import win32com.shell
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\win32com\__init__.py", line 6, in <module>
import pythoncom
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\win32\lib\pywintypes.py", line 105, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Users\Ariel\AppData\Roaming\Python\Python39\site-packages\win32\lib\pywintypes.py", line 99, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
Print Output:
Variables:
{}

Actually, I wasn't able to reproduce this with python 3.9.4 on Windows w/ pandas 1.5.2 and sklearn 1.2.0. What version of pandas and sklearn were you using?