mljar / mljar-api-python

A simple python wrapper over MLJAR API.
https://docs.mljar.com/
Apache License 2.0
42 stars 10 forks source link

problem with running predictions on windows machines #3

Closed pplonski closed 7 years ago

pplonski commented 7 years ago

When computing predictions on windows machine there is error:

pred = Mljar.compute_prediction(df, model_id = 'xxxxxxx', project_id = 'xxxxxxxxxxxx',keep_dataset=True)

IOError                                   Traceback (most recent call last)
<ipython-input-8-e3ccbf396609> in <module>()
----> 1 pred = Mljar.compute_prediction(df, model_id = 'xxxxxxxx', project_id = 'xxxxxxxxxx',keep_dataset=True)

c:\python27\lib\site-packages\mljar\mljar.pyc in compute_prediction(X, model_id, project_id, keep_dataset)
    328 
    329         # chack if dataset exists in mljar if not upload dataset for prediction
--> 330         dataset = DatasetClient(project_id).add_dataset_if_not_exists(X, y = None)
    331 
    332         # check if prediction is available

c:\python27\lib\site-packages\mljar\client\dataset.pyc in add_dataset_if_not_exists(self, X, y, title_prefix)
    128         if len(dataset_details) == 0:
    129             # add new dataset
--> 130             dataset_details = self.add_new_dataset(data, y, title_prefix)
    131         else:
    132             dataset_details = dataset_details[0]

c:\python27\lib\site-packages\mljar\client\dataset.pyc in add_new_dataset(self, data, y, title_prefix)
    166         prediction_only = y is None
    167         # save to local storage
--> 168         data.to_csv(file_path, index=False)
    169         # compress
    170         file_path_zip = file_path + '.zip'

c:\python27\lib\site-packages\pandas\core\frame.pyc in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, tupleize_cols, date_format, doublequote, escapechar, decimal)
   1401                                      doublequote=doublequote,
   1402                                      escapechar=escapechar, decimal=decimal)
-> 1403         formatter.save()
   1404 
   1405         if path_or_buf is None:

c:\python27\lib\site-packages\pandas\io\formats\format.pyc in save(self)
   1569             f, handles = _get_handle(self.path_or_buf, self.mode,
   1570                                      encoding=self.encoding,
-> 1571                                      compression=self.compression)
   1572             close = True
   1573 

c:\python27\lib\site-packages\pandas\io\common.pyc in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    377         if compat.PY2:
    378             # Python 2
--> 379             f = open(path_or_buf, mode)
    380         elif encoding:
    381             # Python 3 and encoding

IOError: [Errno 2] No such file or directory: '/tmp/dataset-f8f18b2e.csv'
pplonski commented 7 years ago

It is fixed. There was a problem with path dependency on different OSes.