Failed to instantiate Butler from config file

I am having issues instatiating the butler gen3. I am trying to look at some darks that were recently taken.

This is my code so far:

dataPath = "/repo/main"
instrument = "LSSTComCam"
butler = dafButler.Butler(dataPath, 
                          collections=["LSSTComCam/raw/all", "LSSTComCam/calib/unbounded"],
                          instrument=instrument)

The error that is giving me is: Failed to instantiate Butler from config file:///repo/main/butler.yaml.

Does anyone know what’s going on? Thanks in advance!

Can you give the full error message? I just tried it at NCSA and it seems to work fine for me:

>>> from lsst.daf.butler import Butler
>>> Butler("/repo/main")
<lsst.daf.butler._butler.Butler object at 0x7effd3b40910>

This is the full error message:

---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
   3211         try:
-> 3212             return fn()
   3213         except dialect.dbapi.Error as e:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in connect(self)
    306         """
--> 307         return _ConnectionFairy._checkout(self)
    308 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in _checkout(cls, pool, threadconns, fairy)
    766         if not fairy:
--> 767             fairy = _ConnectionRecord.checkout(pool)
    768 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in checkout(cls, pool)
    424     def checkout(cls, pool):
--> 425         rec = pool._do_get()
    426         try:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/impl.py in _do_get(self)
    145                 with util.safe_reraise():
--> 146                     self._dec_overflow()
    147         else:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
     69             if not self.warn_only:
---> 70                 compat.raise_(
     71                     exc_value,

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/compat.py in raise_(***failed resolving arguments***)
    206         try:
--> 207             raise exception
    208         finally:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/impl.py in _do_get(self)
    142             try:
--> 143                 return self._create_connection()
    144             except:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in _create_connection(self)
    252 
--> 253         return _ConnectionRecord(self)
    254 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __init__(self, pool, connect)
    367         if connect:
--> 368             self.__connect()
    369         self.finalize_callback = deque()

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __connect(self)
    610             with util.safe_reraise():
--> 611                 pool.logger.debug("Error on connect(): %s", e)
    612         else:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
     69             if not self.warn_only:
---> 70                 compat.raise_(
     71                     exc_value,

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/compat.py in raise_(***failed resolving arguments***)
    206         try:
--> 207             raise exception
    208         finally:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __connect(self)
    604             self.starttime = time.time()
--> 605             connection = pool._invoke_creator(self)
    606             pool.logger.debug("Created new connection %r", connection)

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/create.py in connect(connection_record)
    577                         return connection
--> 578             return dialect.connect(*cargs, **cparams)
    579 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/default.py in connect(self, *cargs, **cparams)
    583         # inherits the docstring from interfaces.Dialect.connect
--> 584         return self.dbapi.connect(*cargs, **cparams)
    585 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/psycopg2/__init__.py in connect(dsn, connection_factory, cursor_factory, **kwargs)
    121     dsn = _ext.make_dsn(dsn, **kwargs)
--> 122     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    123     if cursor_factory is not None:

OperationalError: fe_sendauth: no password supplied


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

OperationalError                          Traceback (most recent call last)
/tmp/ipykernel_3500103/1769582562.py in <module>
      4 dataPath = "/repo/main"
      5 instrument = "LSSTComCam"
----> 6 butler = dafButler.Butler(dataPath, 
      7                           collections=["LSSTComCam/raw/all", "LSSTComCam/calib/unbounded"],
      8                           instrument=instrument)

/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/daf_butler/22.0.1-115-g4df6d8ec+eea9857b34/python/lsst/daf/butler/_butler.py in __init__(self, config, butler, collections, run, searchPaths, writeable, inferDefaults, **kwargs)
    258                 if writeable is None:
    259                     writeable = run is not None
--> 260                 self.registry = Registry.fromConfig(self._config, butlerRoot=butlerRoot, writeable=writeable,
    261                                                     defaults=defaults)
    262                 self.datastore = Datastore.fromConfig(self._config, self.registry.getDatastoreBridgeManager(),

/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/daf_butler/22.0.1-115-g4df6d8ec+eea9857b34/python/lsst/daf/butler/registry/_registry.py in fromConfig(cls, config, butlerRoot, writeable, defaults)
    226         # registry.
    227         registry_cls, registry_config = cls.determineTrampoline(config)
--> 228         return registry_cls.fromConfig(config, butlerRoot, writeable, defaults)
    229 
    230     @abstractmethod

/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/daf_butler/22.0.1-115-g4df6d8ec+eea9857b34/python/lsst/daf/butler/registries/sql.py in fromConfig(cls, config, butlerRoot, writeable, defaults)
    190         config.replaceRoot(butlerRoot)
    191         DatabaseClass = config.getDatabaseClass()
--> 192         database = DatabaseClass.fromUri(str(config.connectionString), origin=config.get("origin", 0),
    193                                          namespace=config.get("namespace"), writeable=writeable)
    194         managerTypes = RegistryManagerTypes.fromConfig(config)

/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/daf_butler/22.0.1-115-g4df6d8ec+eea9857b34/python/lsst/daf/butler/registry/interfaces/_database.py in fromUri(cls, uri, origin, namespace, writeable)
    367             A new `Database` instance.
    368         """
--> 369         return cls.fromEngine(cls.makeEngine(uri, writeable=writeable),
    370                               origin=origin,
    371                               namespace=namespace,

/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/daf_butler/22.0.1-115-g4df6d8ec+eea9857b34/python/lsst/daf/butler/registry/databases/postgresql.py in fromEngine(cls, engine, origin, namespace, writeable)
     96     def fromEngine(cls, engine: sqlalchemy.engine.Engine, *, origin: int,
     97                    namespace: Optional[str] = None, writeable: bool = True) -> Database:
---> 98         return cls(engine=engine, origin=origin, namespace=namespace, writeable=writeable)
     99 
    100     @contextmanager

/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/daf_butler/22.0.1-115-g4df6d8ec+eea9857b34/python/lsst/daf/butler/registry/databases/postgresql.py in __init__(self, engine, origin, namespace, writeable)
     68                  namespace: Optional[str] = None, writeable: bool = True):
     69         super().__init__(origin=origin, engine=engine, namespace=namespace)
---> 70         with engine.connect() as connection:
     71             dbapi = connection.connection
     72             try:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in connect(self, close_with_result)
   3164         """
   3165 
-> 3166         return self._connection_cls(self, close_with_result=close_with_result)
   3167 
   3168     @util.deprecated(

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in __init__(self, engine, connection, close_with_result, _branch_from, _execution_options, _dispatch, _has_events, _allow_revalidate)
     94                 connection
     95                 if connection is not None
---> 96                 else engine.raw_connection()
     97             )
     98 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in raw_connection(self, _connection)
   3243 
   3244         """
-> 3245         return self._wrap_pool_connect(self.pool.connect, _connection)
   3246 
   3247 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
   3213         except dialect.dbapi.Error as e:
   3214             if connection is None:
-> 3215                 Connection._handle_dbapi_exception_noconnection(
   3216                     e, dialect, self
   3217                 )

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _handle_dbapi_exception_noconnection(cls, e, dialect, engine)
   2067             util.raise_(newraise, with_traceback=exc_info[2], from_=e)
   2068         elif should_wrap:
-> 2069             util.raise_(
   2070                 sqlalchemy_exception, with_traceback=exc_info[2], from_=e
   2071             )

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/compat.py in raise_(***failed resolving arguments***)
    205 
    206         try:
--> 207             raise exception
    208         finally:
    209             # credit to

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
   3210         dialect = self.dialect
   3211         try:
-> 3212             return fn()
   3213         except dialect.dbapi.Error as e:
   3214             if connection is None:

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in connect(self)
    305 
    306         """
--> 307         return _ConnectionFairy._checkout(self)
    308 
    309     def _return_conn(self, record):

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in _checkout(cls, pool, threadconns, fairy)
    765     def _checkout(cls, pool, threadconns=None, fairy=None):
    766         if not fairy:
--> 767             fairy = _ConnectionRecord.checkout(pool)
    768 
    769             fairy._pool = pool

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in checkout(cls, pool)
    423     @classmethod
    424     def checkout(cls, pool):
--> 425         rec = pool._do_get()
    426         try:
    427             dbapi_connection = rec.get_connection()

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/impl.py in _do_get(self)
    144             except:
    145                 with util.safe_reraise():
--> 146                     self._dec_overflow()
    147         else:
    148             return self._do_get()

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
     68             self._exc_info = None  # remove potential circular references
     69             if not self.warn_only:
---> 70                 compat.raise_(
     71                     exc_value,
     72                     with_traceback=exc_tb,

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/compat.py in raise_(***failed resolving arguments***)
    205 
    206         try:
--> 207             raise exception
    208         finally:
    209             # credit to

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/impl.py in _do_get(self)
    141         if self._inc_overflow():
    142             try:
--> 143                 return self._create_connection()
    144             except:
    145                 with util.safe_reraise():

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in _create_connection(self)
    251         """Called by subclasses to create a new ConnectionRecord."""
    252 
--> 253         return _ConnectionRecord(self)
    254 
    255     def _invalidate(self, connection, exception=None, _checkin=True):

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __init__(self, pool, connect)
    366         self.__pool = pool
    367         if connect:
--> 368             self.__connect()
    369         self.finalize_callback = deque()
    370 

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __connect(self)
    609         except Exception as e:
    610             with util.safe_reraise():
--> 611                 pool.logger.debug("Error on connect(): %s", e)
    612         else:
    613             # in SQLAlchemy 1.4 the first_connect event is not used by

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
     68             self._exc_info = None  # remove potential circular references
     69             if not self.warn_only:
---> 70                 compat.raise_(
     71                     exc_value,
     72                     with_traceback=exc_tb,

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/util/compat.py in raise_(***failed resolving arguments***)
    205 
    206         try:
--> 207             raise exception
    208         finally:
    209             # credit to

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/pool/base.py in __connect(self)
    603         try:
    604             self.starttime = time.time()
--> 605             connection = pool._invoke_creator(self)
    606             pool.logger.debug("Created new connection %r", connection)
    607             self.connection = connection

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/create.py in connect(connection_record)
    576                     if connection is not None:
    577                         return connection
--> 578             return dialect.connect(*cargs, **cparams)
    579 
    580         creator = pop_kwarg("creator", connect)

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/sqlalchemy/engine/default.py in connect(self, *cargs, **cparams)
    582     def connect(self, *cargs, **cparams):
    583         # inherits the docstring from interfaces.Dialect.connect
--> 584         return self.dbapi.connect(*cargs, **cparams)
    585 
    586     def create_connect_args(self, url):

/software/lsstsw/stack_20210813/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe/lib/python3.8/site-packages/psycopg2/__init__.py in connect(dsn, connection_factory, cursor_factory, **kwargs)
    120 
    121     dsn = _ext.make_dsn(dsn, **kwargs)
--> 122     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    123     if cursor_factory is not None:
    124         conn.cursor_factory = cursor_factory

OperationalError: (psycopg2.OperationalError) fe_sendauth: no password supplied

(Background on this error at: https://sqlalche.me/e/14/e3q8)

​

Please read the database authentication setup information in /repo/README.md.