kunaldahiya / pyxclib

Tools for multi-label classification problems.
MIT License
126 stars 36 forks source link

ModuleNotFoundError: No module named 'xclib.utils._sparse' #11

Closed dchou1618 closed 2 years ago

dchou1618 commented 3 years ago

I'm running into the above issue when running from xclib.data import data_utils

kunaldahiya commented 3 years ago

Hi,

Thanks for trying it out. Can you please make sure that you are not running from xclib/pyxclib directory after installation.

dchou1618 commented 3 years ago

Hi @kunaldahiya. Yes, I realized that yesterday and it works haha.

tash149 commented 3 years ago

Hi @kunaldahiya I'm facing the same issue. Though I've run the command python3 setup.py install --user and I'm executing the code from pyxclib directory and not from xclib one.

I faced this while trying to run sparse_bow_features_from_raw_data.py file

kunaldahiya commented 3 years ago

Can you please try running it from somewhere else? Python will try to import from local files in this case.

tash149 commented 3 years ago

Thanks for replying so quickly :) I'll try it out

tash149 commented 3 years ago

Hi @kunaldahiya I'm still running into an error ImportError: cannot import name 'VectorizerMixin' Sorry for troubling you 😅

This is the Traceback: Traceback (most recent call last): File ".\sparse_bow_features_from_raw_data.py", line 6, in from xclib.utils.text import BoWFeatures File "C:\Users\tarushi_sharma\AppData\Roaming\Python\Python36\site-packages\xclib-0.97-py3.6-win-amd64.egg\xclib\utils\text.py", line 11, in from sklearn.feature_extraction.text import TfidfVectorizer, VectorizerMixin

All my other packages are in the location "c:\users\tarushi_sharma\appdata\local\programs\python\python36\lib\site-packages"

Also, I don't know if it would matter but I used to work on Linux earlier but since my system recently crashed, I shifted to Windows

cissagatto commented 2 years ago

Hi everyone!!

I'm getting the same problem:

################################################################### runcell(0, '/home/elaine/Documents/datasets_xmlc.py') Traceback (most recent call last): File "/home/elaine/Documents/datasets_xmlc.py", line 9, in import xclib ModuleNotFoundError: No module named 'xclib' ###################################################################

How can I fix it?! I'm not well proficient in python as well. My file is in the /home/elaine/Documents/ folder and the package is installed at the /home/elaine/ folder.

Thanks

kunaldahiya commented 2 years ago

Can you please check if the notebook is using the same python version as used by xclib? It seems like (jupyter?) notebook is not detecting the installed library.

cissagatto commented 2 years ago

Hi Kunal

I'm using Spyder IDE. But I will check and return to you. I'm not at home right now.

Thanks for now

Enviado do smartphone!

On Wed, Dec 8, 2021, 13:17 Kunal Dahiya @.***> wrote:

Can you please check if the notebook is using the same python version as used by xclib? It seems like (jupyter?) notebook is not detecting the installed library.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kunaldahiya/pyxclib/issues/11#issuecomment-988959147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7DF5LXBSKFZRY3PVNPBDDUP6AH3ANCNFSM4X7GZOAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

cissagatto commented 2 years ago

Can you please check if the notebook is using the same python version as used by xclib? It seems like (jupyter?) notebook is not detecting the installed library.

Kunal!!! Please, can you tell me what is the version of python you used? My laptop configurations:

################################### elaine@bionote:~$ which python /usr/bin/python

elaine@bionote:~$ which python3 /usr/bin/python3

elaine@bionote:~$ python Python 2.7.18 (default, Mar 8 2021, 13:02:45) [GCC 9.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

elaine@bionote:~$ python3 Python 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

elaine@bionote:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal ###################################

When I went out after sending a message to you, I power off my laptop. Then, when I came back I power on it. It seems that a restart helped with some issues because now I'm getting other errors:

############################################################################################## runcell(0, '/home/elaine/Documents/datasets_xmlc.py') Traceback (most recent call last): File "/home/elaine/Documents/datasets_xmlc.py", line 13, in features, tabels, num_samples, num_features, num_labels = data_utils.read_data('train.txt') File "/home/elaine/.local/lib/python3.8/site-packages/xclib-0.97-py3.8-linux-x86_64.egg/xclib/data/data_utils.py", line 342, in read_data with open(filename, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: 'train.txt' ##############################################################################################

I believe that now is an issue about the folder where is my train.txt and the permissions for the file. So, I really don't know what exactly happened that fixed the problem. Do you have any idea? I hope that this can help others.

Thanks a lot!

cissagatto commented 2 years ago

HI

I'm getting new errors from this line

labels = data_utils.read_sparse_file('/home/elaine/Documents/Xf.txt', header=True)

################################################## Traceback (most recent call last):

File "/tmp/ipykernel_5595/4045602250.py", line 1, in labels = data_utils.read_sparse_file('/home/elaine/Documents/Xf.txt', header=True)

File "/home/elaine/.local/lib/python3.8/site-packages/xclib-0.97-py3.8-linux-x86_64.egg/xclib/data/data_utils.py", line 243, in read_sparse_file query_values, _header_shape = _read_file_safe(file,

File "/home/elaine/.local/lib/python3.8/site-packages/xclib-0.97-py3.8-linux-x86_64.egg/xclib/utils/sparse.py", line 238, in _read_file_safe f, _header_shape = _handle_header(f, header)

File "/home/elaine/.local/lib/python3.8/site-packages/xclib-0.97-py3.8-linux-x86_64.egg/xclib/utils/sparse.py", line 228, in _handle_header num_cols, num_rows = map(

ValueError: invalid literal for int() with base 10: '0%' ####################################################################################################

What to do? Thanks

kunaldahiya commented 2 years ago

Hi

'read_data' is meant to read files in the following format (containing features and the labels). You can download the EURLex-4K dataset.

2 4 5
1,2 0:0.5 1:0.4 2: 0.3
2,3,4 1:0.5 2:0.4 3:0.8

'read_sparse_file' is meant to read files like the following (only features are available)

2 4
0:0.5 1:0.4 2:0.3
2:0.4 3:0.3