Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fails to call atm = ATM()? #159

Open
Alla-Abdella opened this issue Mar 20, 2020 · 6 comments
Open

Fails to call atm = ATM()? #159

Alla-Abdella opened this issue Mar 20, 2020 · 6 comments

Comments

@Alla-Abdella
Copy link

OperationalError                          Traceback (most recent call last)
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)
   1248                     self.dialect.do_execute(
-> 1249                         cursor, statement, parameters, context
   1250                     )

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/default.py in do_execute(self, cursor, statement, parameters, context)
    579     def do_execute(self, cursor, statement, parameters, context=None):
--> 580         cursor.execute(statement, parameters)
    581 

OperationalError: database is locked

The above exception was the direct cause of the following exception:

OperationalError                          Traceback (most recent call last)
<ipython-input-141-90878e6be8ba> in <module>
      3 
      4 from atm import ATM
----> 5 atm = ATM()

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/atm/core.py in __init__(self, dialect, database, username, password, host, port, query, access_key, secret_key, s3_bucket, s3_folder, models_dir, metrics_dir, verbose_metrics)
     51     ):
     52 
---> 53         self.db = Database(dialect, database, username, host, port, query)
     54         self.aws_access_key = access_key
     55         self.aws_secret_key = secret_key

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/atm/database.py in __init__(self, dialect, database, username, password, host, port, query)
     99 
    100         # create ORM objects for the tables
--> 101         self._define_tables()
    102 
    103     def _define_tables(self):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/atm/database.py in _define_tables(self)
    506         self.Classifier = Classifier
    507 
--> 508         Base.metadata.create_all(bind=self.engine)
    509 
    510     # ##########################################################################

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/sql/schema.py in create_all(self, bind, tables, checkfirst)
   4302             bind = _bind_or_error(self)
   4303         bind._run_visitor(
-> 4304             ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
   4305         )
   4306 

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _run_visitor(self, visitorcallable, element, connection, **kwargs)
   2044     ):
   2045         with self._optional_conn_ctx_manager(connection) as conn:
-> 2046             conn._run_visitor(visitorcallable, element, **kwargs)
   2047 
   2048     class _trans_ctx(object):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _run_visitor(self, visitorcallable, element, **kwargs)
   1613 
   1614     def _run_visitor(self, visitorcallable, element, **kwargs):
-> 1615         visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
   1616 
   1617 

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py in traverse_single(self, obj, **kw)
    136             meth = getattr(v, "visit_%s" % obj.__visit_name__, None)
    137             if meth:
--> 138                 return meth(obj, **kw)
    139 
    140     def iterate(self, obj):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py in visit_metadata(self, metadata)
    779                     create_ok=True,
    780                     include_foreign_key_constraints=fkcs,
--> 781                     _is_metadata_operation=True,
    782                 )
    783             else:

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py in traverse_single(self, obj, **kw)
    136             meth = getattr(v, "visit_%s" % obj.__visit_name__, None)
    137             if meth:
--> 138                 return meth(obj, **kw)
    139 
    140     def iterate(self, obj):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py in visit_table(self, table, create_ok, include_foreign_key_constraints, _is_metadata_operation)
    824                 table,
    825                 include_foreign_key_constraints=  # noqa
--> 826                     include_foreign_key_constraints,
    827             )
    828             # fmt: on

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in execute(self, object_, *multiparams, **params)
    986             raise exc.ObjectNotExecutableError(object_)
    987         else:
--> 988             return meth(self, multiparams, params)
    989 
    990     def _execute_function(self, func, multiparams, params):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py in _execute_on_connection(self, connection, multiparams, params)
     70 
     71     def _execute_on_connection(self, connection, multiparams, params):
---> 72         return connection._execute_ddl(self, multiparams, params)
     73 
     74     def execute(self, bind=None, target=None):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _execute_ddl(self, ddl, multiparams, params)
   1048             compiled,
   1049             None,
-> 1050             compiled,
   1051         )
   1052         if self._has_events or self.engine._has_events:

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)
   1251         except BaseException as e:
   1252             self._handle_dbapi_exception(
-> 1253                 e, statement, parameters, cursor, context
   1254             )
   1255 

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _handle_dbapi_exception(self, e, statement, parameters, cursor, context)
   1471                 util.raise_from_cause(newraise, exc_info)
   1472             elif should_wrap:
-> 1473                 util.raise_from_cause(sqlalchemy_exception, exc_info)
   1474             else:
   1475                 util.reraise(*exc_info)

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/util/compat.py in raise_from_cause(exception, exc_info)
    396     exc_type, exc_value, exc_tb = exc_info
    397     cause = exc_value if exc_value is not exception else None
--> 398     reraise(type(exception), exception, tb=exc_tb, cause=cause)
    399 
    400 

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/util/compat.py in reraise(tp, value, tb, cause)
    150             value.__cause__ = cause
    151         if value.__traceback__ is not tb:
--> 152             raise value.with_traceback(tb)
    153         raise value
    154 

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)
   1247                 if not evt_handled:
   1248                     self.dialect.do_execute(
-> 1249                         cursor, statement, parameters, context
   1250                     )
   1251         except BaseException as e:

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/sqlalchemy/engine/default.py in do_execute(self, cursor, statement, parameters, context)
    578 
    579     def do_execute(self, cursor, statement, parameters, context=None):
--> 580         cursor.execute(statement, parameters)
    581 
    582     def do_execute_no_params(self, cursor, statement, context=None):

OperationalError: (sqlite3.OperationalError) database is locked
[SQL: 
CREATE TABLE datasets (
	id INTEGER NOT NULL, 
	name VARCHAR(100) NOT NULL, 
	class_column VARCHAR(100) NOT NULL, 
	train_path VARCHAR(200) NOT NULL, 
	test_path VARCHAR(200), 
	description VARCHAR(1000), 
	n_examples INTEGER NOT NULL, 
	k_classes INTEGER NOT NULL, 
	d_features INTEGER NOT NULL, 
	majority NUMERIC(10, 9) NOT NULL, 
	size_kb INTEGER NOT NULL, 
	PRIMARY KEY (id)
)

]
(Background on this error at: http://sqlalche.me/e/e3q8)
@micahjsmith
Copy link
Member

Thanks for reporting! Can you tell us what you were trying to do and share additional information that might help us reproduce this issue?

@Alla-Abdella
Copy link
Author

Alla-Abdella commented Mar 20, 2020

@micahjsmith
I first: pip install atm
And then tr to use your example to get started. But, the error is what I get after install the atm successfully.

Requirement already satisfied: atm in /anaconda/envs/azureml_py36/lib/python3.6/site-packages (0.2.2)

@Alla-Abdella
Copy link
Author

This command doesn't work too:
atm download_demo pollution_1.csv
Here is your example:
https://hdi-project.github.io/ATM/readme.html#get-the-demo-data

@Alla-Abdella
Copy link
Author

or this one:

AttributeError Traceback (most recent call last)
in
1 import atm
----> 2 results = atm.run(train_path='https://atm-data.s3.amazonaws.com/pollution_1.csv')

AttributeError: module 'atm' has no attribute 'run'

@micahjsmith micahjsmith transferred this issue from HDI-Project/ATMSeer Mar 20, 2020
@micahjsmith
Copy link
Member

I have transferred the issue as it does not related to ATMSeer

@melissadale
Copy link

If this helps anybody else who is struggling, I have used ATM on and off for a few years now. Running from PowerShell or Ubuntu for Windows on windows works sometimes, other times not (currently not). I am able to reliably run through PyCharm (I know - I know, using IDE's isn't for everybody).

These are the steps that work for me to get ATM to run on my Windows10 machines:

  1. New PyCharm project with a Conda virtual env
  2. Using the terminal within PyCharm, run pip install atm
  3. Create python file with the example code
from atm import ATM

atm = ATM()
# Assuming you have the CSV in the same directory as your python file:
results = atm.run(train_path='./pollution_1.csv')

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

No branches or pull requests

3 participants