Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error loading data when installed with pip #3

Open
jasonzutty opened this issue Jul 2, 2021 · 1 comment
Open

Error loading data when installed with pip #3

jasonzutty opened this issue Jul 2, 2021 · 1 comment

Comments

@jasonzutty
Copy link

jasonzutty commented Jul 2, 2021

>>> from mil.data.datasets import musk1
>>> (bags_train, y_train), (bags_test, y_test) = musk1.load()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/mil/data/datasets/musk1.py", line 7, in load
    return load_data(current_file + './csv/musk1.csv')
  File "/usr/local/lib/python3.7/site-packages/mil/data/datasets/loader.py", line 10, in load_data
    df = pd.read_csv(filepath, header=None)
  File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 676, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 448, in _read
    parser = TextFileReader(fp_or_buf, **kwds)
  File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 880, in __init__
    self._make_engine(self.engine)
  File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 1114, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "/usr/local/lib/python3.7/site-packages/pandas/io/parsers.py", line 1891, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 374, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas/_libs/parsers.pyx", line 673, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File /usr/local/lib/python3.7/site-packages/mil/data/datasets./csv/musk1.csv does not exist: '/usr/local/lib/python3.7/site-packages/mil/data/datasets./csv/musk1.csv'

package was installed with pip.

@jasonzutty
Copy link
Author

jasonzutty commented Jul 2, 2021

Problem might be a linux vs windows issue, the result of the code:

import os

from mil.data.datasets.loader import load_data

current_file = os.path.abspath(os.path.dirname(__file__))
def load():
    return load_data(os.path.join(current_file, './csv/musk1.csv'))

Isn't putting the necessary file separator between what comes out of current_file and the './csv/musk1.csv'

I would recommend taking out the preceding ./ and replacing the line with return load_data(os.path.join(current_file, 'csv/musk1.csv')), I believe this will work.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant