2

When I try to import the hmmlearn package with import hmmlearn, I get this error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-036832e0c673> in <module>
----> 1 import hmmlearn

~\Anaconda3\envs\py385\lib\site-packages\hmmlearn\__init__.py in <module>
      9 try:
     10     import setuptools_scm
---> 11     __version__ = setuptools_scm.get_version(  # xref setup.py
     12         root="../..", relative_to=__file__,
     13         version_scheme="post-release", local_scheme="node-and-date")

AttributeError: module 'setuptools_scm' has no attribute 'get_version'

I'm in a python 3.8.5 env on a windows machine. In other environments on this machine (e.g. py 3.7) I don't get the error. Also on my MacOs machine in an 3.8.5 env I can import the package without any problems. In all cases I used pip install hmmlearn to get the package.

I uninstalled and re-installed the hmmlearn and the setuptools_scm package, but that didn't fix it.

It seems like the is a problem with my setuptools_scm package. How can this be fixed? Is there a way to completely remove the hmm package and all its dependencies and do a "clean" re-install?

Alex905
  • 25
  • 3

2 Answers2

3

I had the same problem on Windows and python 3.8.5. For me, uninstalling the hmmlearn and setuptools_scm and then reinstalling it with conda (I'm in a conda environment) fixed it.

So I did:

pip uninstall hmmlearn
pip uninstall setuptools_scm

and then

conda install -c conda-forge setuptools_scm
conda install -c conda-forge hmmlearn

Also, I restarted the kernel in jupyter notebook.

But I'm not sure if that was really the problem, since I can't recreate the problem by uninstalling it over conda and reinstalling the packages over pip.

canwiper
  • 46
  • 3
  • Thanks, for the suggestion. Additionally to the pip uninstall I manually deleted the setuptools packages in C:\Users\Anaconda3\pkgs and then reinstalled everything like you said with conda install. That fixed it. Thanks for the help! – Alex905 Dec 19 '20 at 08:58
  • I came across the same issue. It was because I was missing the setuptools_scm. After installing it, the issue war solved. – Nocciolate Jul 13 '22 at 20:28
1

For me the solution was

pip uninstall hmmlearn

pip uninstall setuptools_scm

and then simply,

pip install hmmlearn

pip install setuptools_scm

and Kernel restart.

System setup: Windows 10 Pro Python 3.7.4 on conda 4.11.0

Maria
  • 171
  • 1
  • 4