Pip not installing package properly

2.3k Views Asked by At

So I am trying to get hmmlearn working in Jupyter, and I have come across an error while installing Hmmlearn using pip. I have tried this solution, but it didn't work.

It seems to me that pip does install the _hmmc file, but it does so incorrect. instead it has the name

_hmmc.cp35-win_amd64

and the file extesion is .PYD, instead of .c

When I run the code to import it, I get this error :

    ImportError                               Traceback (most recent call last)
    <ipython-input-1-dee84c3d5ff9> in <module>()
          7 import os
          8 from pyAudioAnalysis import audioBasicIO as aB
    ----> 9 from pyAudioAnalysis import audioAnalysis as aA

    C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioAnalysis.py in <module>()
         15 import audioFeatureExtraction as aF
         16 import audioTrainTest as aT
   --->  17 import audioSegmentation as aS
         18 import audioVisualization as aV
         19 import audioBasicIO

    C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioSegmentation.py in <module>()
         16 import sklearn
         17 import sklearn.cluster
    ---> 18 import hmmlearn.hmm
         19 import cPickle
         20 import glob

    C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\hmm.py in <module>()
         19 from sklearn.utils import check_random_state
         20 
    ---> 21 from .base import _BaseHMM
         22 from .utils import iter_from_X_lengths, normalize
         23 

    C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\base.py in <module>()
         11 from sklearn.utils.validation import check_is_fitted
         12 
    ---> 13 from . import _hmmc
         14 from .utils import normalize, log_normalize, iter_from_X_lengths
         15 

    ImportError: cannot import name _hmmc 

I don't know why pip just doesn't install it correctly, even when I tried to use --no-cache-dir

Edit: So i figured out what the problem was. my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version. I had to change my active python enviroment: using activate <my_enviroment name> after that i could just use pip to install it again and it worked this time.

3

There are 3 best solutions below

0
On BEST ANSWER

So i figured out what the problem was. my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version. I had to change my active python enviroment: using activate <my_enviroment_name> after that i could just use pip to install it again and it worked this time.

0
On

not sure if it could be helpful to anyone but I installed hmmlearn as follows in my Jupyter Lab:

import sys
!{sys.executable} -m pip install hmmlearn
4
On

Looking at your error message I guess that you have downloaded the hmmlearn package from GIT. Have you tried using a wheel (*.whl) file instead? You can download one from here. Check out which version fits your python installation.

Then use:

pip install <the_wheel_that_corresponds_to_your_python_version>.whl

Hope it helps.