markovmodel / PyEMMA

🚂 Python API for Emma's Markov Model Algorithms 🚂
http://pyemma.org
GNU Lesser General Public License v3.0
311 stars 119 forks source link

Fresh conda install broken (at least for kmeans clustering) due to deeptime ImportError #1516

Closed rafwiewiora-silicon closed 3 years ago

rafwiewiora-silicon commented 3 years ago

Hi guys,

Have been showing someone how to use PyEMMA today, we did a fresh conda install and just discovered on pyemma.coordinates.cluster_kmeans([[0,1,2]]) you get:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-2175f7426617> in <module>
----> 1 pyemma.coordinates.cluster_kmeans([[0,1,2]])

~/miniconda3/envs/pyemma_test/lib/python3.9/site-packages/pyemma/coordinates/api.py in cluster_kmeans(data, k, max_iter, tolerance, stride, metric, init_strategy, fixed_seed, n_jobs, chunksize, skip, keep_data, clustercenters, **kwargs)
   1823     cs = _check_old_chunksize_arg(chunksize, get_default_args(cluster_kmeans)['chunksize'], **kwargs)
   1824     if data is not None:
-> 1825         res.estimate(data, chunksize=cs)
   1826     else:
   1827         res.chunksize = cs

~/miniconda3/envs/pyemma_test/lib/python3.9/site-packages/pyemma/coordinates/data/_base/transformer.py in estimate(self, X, **kwargs)
    213     """ Basis class for pipelined Transformers, which perform also estimation. """
    214     def estimate(self, X, **kwargs):
--> 215         super(StreamingEstimationTransformer, self).estimate(X, **kwargs)
    216         # we perform the mapping to memory exactly here, because a StreamingEstimator on its own
    217         # has not output to be mapped. Only the combination of Estimation/Transforming has this feature.

~/miniconda3/envs/pyemma_test/lib/python3.9/site-packages/pyemma/coordinates/data/_base/streaming_estimator.py in estimate(self, X, chunksize, **kwargs)
     42         # run estimation
     43         try:
---> 44             super(StreamingEstimator, self).estimate(X, **kwargs)
     45         except NotConvergedWarning as ncw:
     46             self.logger.info(

~/miniconda3/envs/pyemma_test/lib/python3.9/site-packages/pyemma/_base/estimator.py in estimate(self, X, **params)
    405         if params:
    406             self.set_params(**params)
--> 407         self._model = self._estimate(X)
    408         # ensure _estimate returned something
    409         assert self._model is not None

~/miniconda3/envs/pyemma_test/lib/python3.9/site-packages/pyemma/coordinates/clustering/kmeans.py in _estimate(self, iterable, **kw)
    199 
    200     def _estimate(self, iterable, **kw):
--> 201         self._init_estimate()
    202         ctx = nullcontext() if 'data' not in self._progress_registered_stages else self._progress_context(stage='data')
    203         # collect the data only if, we have not done this previously (eg. keep_data=True)

~/miniconda3/envs/pyemma_test/lib/python3.9/site-packages/pyemma/coordinates/clustering/kmeans.py in _init_estimate(self)
    293                             math.ceil((traj_len / float(total_length)) * self.n_clusters)))
    294 
--> 295         from ._ext import kmeans as kmeans_mod
    296         self._inst = kmeans_mod.Kmeans_f(self.n_clusters, self.metric, self.data_producer.ndim)
    297 

ImportError: AttributeError: module 'deeptime.clustering._clustering_bindings' has no attribute 'Metric'

which I guess is due to https://github.com/deeptime-ml/deeptime/commit/4aba39251baab40719b7b369097bb088f36a8e48

I looked at what version of deeptime my working installation has (0.2.7), downgrading to that after the new PyEMMA install solves it.

clonker commented 3 years ago

yup that was my bad. fixing it in the conda-forge package, with the next pyemma release everything should be deeptime-compatible for the recent versions, too.