msmbuilder icon indicating copy to clipboard operation
msmbuilder copied to clipboard

ImportError after installation

Open vikshiv opened this issue 6 years ago • 9 comments

After installation on MacOS 10.14.1, with miniconda, using the command conda install -c omnia msmbuilder, I am getting an ImportError: No module named grid_search.

Here is the full traceback from running msmb -h:

Traceback (most recent call last): File "/Users/vikram/miniconda3/bin/msmb", line 4, in import msmbuilder.scripts.msmb File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/scripts/msmb.py", line 5, in from ..commands import * File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/commands/init.py", line 5, in from .example_datasets import AlanineDipeptideDatasetCommand File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/commands/example_datasets.py", line 4, in from ..example_datasets import (AlanineDipeptide, DoubleWell, QuadWell, FsPeptide, File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/example_datasets/init.py", line 3, in from .brownian1d import DoubleWell, QuadWell File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/example_datasets/brownian1d.py", line 17, in from ..msm import _solve_msm_eigensystem File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/msm/init.py", line 2, in from .core import * File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/msm/core.py", line 17, in from ..utils import list_of_1d File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/utils/init.py", line 4, in from .param_sweep import * File "/Users/vikram/miniconda3/lib/python2.7/site-packages/msmbuilder/utils/param_sweep.py", line 3, in from sklearn.grid_search import ParameterGrid ImportError: No module named grid_search

I am using a Miniconda 3.7 installation, but also have python 3.6 and python 2.7 installed on my machine. I freshly installed miniconda to install MSMbuilder, so it is the latest version.

vikshiv avatar Jun 29 '19 22:06 vikshiv

Hello, I am receiving a similar issue after installing MSMBuilder 3.8.0 from conda install -c omnia msmbuilder and trying to import msmbuilder.cluster into my code with from msmbuilder import cluster. I believe sklearn.grid_search has been removed in favor of sklearn.model_selection, and I think this is causing the error. I'm not entirely certain though.

jstoppelman avatar Jun 30 '19 01:06 jstoppelman

Same thing here. Should be an easy fix just changing the import, might try to do it myself. I've heard from the old maintainers that no one is maintaining the project anymore.

salotz avatar Jul 30 '19 22:07 salotz

Actually, this is addressed in the code, its just not in the build. https://github.com/msmbuilder/msmbuilder/blob/master/msmbuilder/utils/param_sweep.py#L3 They would need to do a new release and publish to PyPI. I tried installing directly from the source tree:

pip install git+https://github.com/msmbuilder/msmbuilder.git

But I get all kinds of compiler errors...

Here is the full listing of commands I run to do this in a fresh env:

env_name="msmbuilder-dev"
conda deactivate
conda create -y -n "$env_name" python=3
conda activate "$env_name"
# build dependencies
conda install -y -c conda-forge cython=0.27.3 numpy mdtraj=1.8
# runtime dependencies
conda install -y -c conda-forge scipy scikit-learn numpydoc pytables pyhmc pyyaml jinja2 fastcluster
pip install git+https://github.com/msmbuilder/msmbuilder.git

And the full output with extra info in the fancy shell prompt:

msmbuilder_build_failure.txt

$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

salotz avatar Jul 31 '19 17:07 salotz

I am able to build on my machine if I use the 3.8.0 commit tag:

pip install git+https://github.com/msmbuilder/[email protected]

But the fix happened recently: https://github.com/msmbuilder/msmbuilder/commit/8c901a3d0a114c97e406d19dfeb2fcd45fc927c2

My fork resets back to 3.8.0 so I can build it and then makes the necessary fixes (for me to run KCenters at least, I haven't run the tests): https://github.com/salotz/msmbuilder

salotz avatar Jul 31 '19 20:07 salotz

is there a issue open for the build failure? it looks like it might be a issue related to a newer version of cython.

rmcgibbo avatar Jul 31 '19 22:07 rmcgibbo

I don't know if I am building properly as I wasn't able to find a comprehensive guide, just wanted to share my workaround give as much info as I had so I didn't want to raise that as an issue. I just installed the packages from conda-forge as they are specified in the up to date meta.yaml file which uses an older cython 0.27.3 https://github.com/msmbuilder/msmbuilder/blob/master/devtools/conda-recipe/meta.yaml#L19 so I don't think it is that.

salotz avatar Aug 01 '19 21:08 salotz

@salotz: with cython==0.24, I get errors like that when running pip install git+https://github.com/msmbuilder/msmbuilder.git, but after doing a pip install Cython==0.28 -U -I, the msmbuilder installation from git+https:// works.

rmcgibbo avatar Aug 03 '19 20:08 rmcgibbo

Works for me now too. I installed with the latest cython from conda-forge (0.29.13). Should've tried that first. Thanks @rmcgibbo.

salotz avatar Aug 05 '19 16:08 salotz

I don't know if I am building properly as I wasn't able to find a comprehensive guide, just wanted to share my workaround give as much info as I had so I didn't want to raise that as an issue. I just installed the packages from conda-forge as they are specified in the up to date meta.yaml file which uses an older cython 0.27.3 https://github.com/msmbuilder/msmbuilder/blob/master/devtools/conda-recipe/meta.yaml#L19 so I don't think it is that.

I am trying to compute Implied time scale but I have this error

/misc/home/marzouk/anaconda3/envs/msmbuilder/lib/python3.6/site-packages/sklearn/externals/joblib/init.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+. warnings.warn(msg, category=DeprecationWarning) An unexpected error has occurred with MSMBuilder (version 3.8.0), please consider sending the following traceback to MSMBuilder GitHub issue tracker at: https://github.com/msmbuilder/msmbuilder/issues

Traceback (most recent call last): File "/misc/home/marzouk/anaconda3/envs/msmbuilder/bin/msmb", line 6, in sys.exit(msmbuilder.scripts.msmb.main()) File "/misc/home/marzouk/anaconda3/envs/msmbuilder/lib/python3.6/site-packages/msmbuilder/scripts/msmb.py", line 28, in main app.start() File "/misc/home/marzouk/anaconda3/envs/msmbuilder/lib/python3.6/site-packages/msmbuilder/cmdline.py", line 464, in start instance.start() File "/misc/home/marzouk/anaconda3/envs/msmbuilder/lib/python3.6/site-packages/msmbuilder/commands/implied_timescales.py", line 101, in start verbose=self.args.verbose) File "/misc/home/marzouk/anaconda3/envs/msmbuilder/lib/python3.6/site-packages/msmbuilder/msm/implied_timescales.py", line 48, in implied_timescales verbose=verbose) File "/misc/home/marzouk/anaconda3/envs/msmbuilder/lib/python3.6/site-packages/msmbuilder/utils/param_sweep.py", line 37, in param_sweep param_grid = ParameterGrid(param_grid) NameError: name 'ParameterGrid' is not defined

mohamedmarzouk22 avatar Nov 05 '20 07:11 mohamedmarzouk22