admin管理员组

文章数量:1122832

I am working on conda/jupyter notebook for a data science project I have a base environment for all my python projects and different virtual environments, i use as kernels depending on what i am working on exactly.

One of said virtual environments is for data science projects, I have downloaded the category encoder library but i still face this issue of the module not found in my code

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[5], line 4
      2 import numpy as np
      3 import matplotlib.pyplot as plt
----> 4 import category_encoders as ce
      5 from sklearn.preprocessing import MinMaxScaler
      6 from sklearn.preprocessing import LabelEncoder

ModuleNotFoundError: No module named 'category_encoders'

I have verified for the presence of the library in the virtual environment there was a positive result

(data_science) C:\Users\yonathan>conda list ipykernel
# packages in environment at C:\Users\EtahMbi\anaconda3\envs\data_science:
#
# Name                    Version                   Build  Channel
ipykernel                 6.29.5          py312haa95532_0


(data_science) C:\Users\yonathan>conda list category_encoders
# packages in environment at C:\Users\EtahMbi\anaconda3\envs\data_science:
#
# Name                    Version                   Build  Channel
category_encoders         2.6.4              pyhd8ed1ab_0    conda-forge

I tried removing the kernelspec and added a new one again just to be certain that the kernel i use in jupyter notebook is the one attached to my virtual environment still no results

(data_science) C:\Users\yonathan>python -m ipykernel install --user --name=data_science --display-name "data_science_1"
Installed kernelspec data_science in C:\Users\yonathan\AppData\Roaming\jupyter\kernels\data_science

I am looking for other solutions or other factors i might have neglected

本文标签: pythonCategory Encoder module not found in code despite being present in virtual environmentStack Overflow